From 3ab2bad21d29a9849385d49b6e1174f1fc36c749 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 22 Oct 2013 16:10:33 +0400 Subject: [PATCH 01/22] frameworks support step suppressed for ruby and python --- .../ide/util/projectWizard/JavaModuleBuilder.java | 6 +----- .../jetbrains/python/module/PythonModuleBuilder.java | 11 +++++++++++ .../com/jetbrains/python/module/PythonModuleType.java | 11 +++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java b/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java index 3940663ee712..d20b1bac8bc0 100644 --- a/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java +++ b/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java @@ -92,11 +92,7 @@ public class JavaModuleBuilder extends ModuleBuilder implements SourcePathsBuild @Override public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ModulesProvider modulesProvider, boolean forNewWizard) { - if (forNewWizard) return ModuleWizardStep.EMPTY_ARRAY; - ModuleType moduleType = getModuleType(); - return moduleType == null - ? ModuleWizardStep.EMPTY_ARRAY - : moduleType.createWizardSteps(wizardContext, this, modulesProvider, false); + return getModuleType().createWizardSteps(wizardContext, this, modulesProvider, forNewWizard); } public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException { diff --git a/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java b/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java index 5f01a9e33f6b..eec3b745107f 100644 --- a/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java +++ b/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java @@ -15,8 +15,12 @@ */ package com.jetbrains.python.module; +import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.SourcePathsBuilder; +import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.openapi.roots.ui.configuration.ModulesProvider; import com.intellij.openapi.util.Pair; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -41,4 +45,11 @@ public class PythonModuleBuilder extends PythonModuleBuilderBase implements Sour } mySourcePaths.add(sourcePathInfo); } + + @Override + public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, + @NotNull ModulesProvider modulesProvider, + boolean forNewWizard) { + return getModuleType().createWizardSteps(wizardContext, this, modulesProvider, forNewWizard); + } } diff --git a/python/pluginSrc/com/jetbrains/python/module/PythonModuleType.java b/python/pluginSrc/com/jetbrains/python/module/PythonModuleType.java index b167e42741d2..3cc4f7a26b2c 100644 --- a/python/pluginSrc/com/jetbrains/python/module/PythonModuleType.java +++ b/python/pluginSrc/com/jetbrains/python/module/PythonModuleType.java @@ -39,13 +39,16 @@ public class PythonModuleType extends PythonModuleTypeBase steps = new ArrayList(); final Project project = getProject(wizardContext); steps.add(new PythonSdkSelectStep(moduleBuilder, "reference.project.structure.sdk.python", project)); - final List providers = FrameworkSupportUtil.getProviders(getInstance(), DefaultFacetsProvider.INSTANCE); - if (!providers.isEmpty()) { - steps.add(new SupportForFrameworksStep(wizardContext, moduleBuilder, LibrariesContainerFactory.createContainer(project))); + if (!forNewWizard) { + final List providers = FrameworkSupportUtil.getProviders(getInstance(), DefaultFacetsProvider.INSTANCE); + if (!providers.isEmpty()) { + steps.add(new SupportForFrameworksStep(wizardContext, moduleBuilder, LibrariesContainerFactory.createContainer(project))); + } } return steps.toArray(new ModuleWizardStep[steps.size()]); } From 6124207ee604a51a48c9de05d5cc26d8ee489fef Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 15:17:25 +0200 Subject: [PATCH 02/22] move toolwindow on top. Instant cancel --- .../ide/actions/SearchEverywhereAction.java | 130 ++++++++++-------- 1 file changed, 76 insertions(+), 54 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 9397bc264e5e..8bd09ac95b36 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -45,7 +45,6 @@ import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.options.ex.IdeConfigurablesGroup; import com.intellij.openapi.options.ex.ProjectConfigurablesGroup; import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.util.ProgressIndicatorBase; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.DumbServiceImpl; @@ -794,7 +793,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } @SuppressWarnings("SSBasedInspection") - private class CalcThread implements Runnable { + private class CalcThread extends Thread { private final Project project; private final String pattern; private ProgressIndicator myProgressIndicator = new ProgressIndicatorBase(); @@ -806,66 +805,61 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA @Override public void run() { - //noinspection SSBasedInspection - UIUtil.invokeAndWaitIfNeeded(new Runnable() { - @Override - public void run() { - myTitleIndexes.clear(); - clearModel(); - myAlreadyAddedFiles.clear(); - } - }); - if (pattern.trim().length() == 0) { - buildModelFromRecentFiles(); - updatePopup(); - return; - } - - checkModelsUpToDate(); - buildTopHit(pattern); - buildRecentFiles(pattern); - updatePopup(); - AccessToken readLock = ApplicationManager.getApplication().acquireReadActionLock(); - if (!DumbServiceImpl.getInstance(project).isDumb()) { - try { - buildClasses(pattern, false); - } finally {readLock.finish();} - updatePopup(); - } - - readLock = ApplicationManager.getApplication().acquireReadActionLock(); try { - buildFiles(pattern); - } finally {readLock.finish();} + //noinspection SSBasedInspection + UIUtil.invokeAndWaitIfNeeded(new Runnable() { + @Override + public void run() { + myTitleIndexes.clear(); + clearModel(); + myAlreadyAddedFiles.clear(); + } + }); + if (pattern.trim().length() == 0) { + buildModelFromRecentFiles(); + updatePopup(); + return; + } - buildActionsAndSettings(pattern); - updatePopup(); + checkModelsUpToDate(); + buildTopHit(pattern); + buildRecentFiles(pattern); + updatePopup(); + buildToolWindows(pattern); + updatePopup(); + + AccessToken readLock = ApplicationManager.getApplication().acquireReadActionLock(); + if (!DumbServiceImpl.getInstance(project).isDumb()) { + try { + buildClasses(pattern, false); + } finally {readLock.finish();} + updatePopup(); + } + + readLock = ApplicationManager.getApplication().acquireReadActionLock(); + try { + buildFiles(pattern); + } finally {readLock.finish();} + + buildActionsAndSettings(pattern); + updatePopup(); + } + catch (Exception ignore) { + } } - private void buildActionsAndSettings(String pattern) { - final Set actions = new HashSet(); - final Set settings = new HashSet(); + private void buildToolWindows(String pattern) { final HashSet toolWindows = new HashSet(); final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE); - List matches = collectResults(pattern, myActions, myActionModel); - for (MatchResult o : matches) { myProgressIndicator.checkCanceled(); Object[] objects = myActionModel.getElementsByName(o.elementName, true, pattern); for (Object object : objects) { myProgressIndicator.checkCanceled(); - if (isSetting(object) && settings.size() < 7) { - if (matcher.matches(getSettingText((OptionDescription)object))) { - settings.add(object); - } - } - else if (isToolWindowAction(object) && toolWindows.size() < 10) { + if (isToolWindowAction(object) && toolWindows.size() < 10) { toolWindows.add((AnAction)((Map.Entry)object).getKey()); } - else if (isActionValue(object) && actions.size() < 7) { - actions.add((AnAction)((Map.Entry)object).getKey()); - } } } @@ -881,6 +875,39 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA myListModel.addElement(toolWindow); } } + } + }); + } + + private void buildActionsAndSettings(String pattern) { + final Set actions = new HashSet(); + final Set settings = new HashSet(); + final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE); + + List matches = collectResults(pattern, myActions, myActionModel); + + for (MatchResult o : matches) { + myProgressIndicator.checkCanceled(); + Object[] objects = myActionModel.getElementsByName(o.elementName, true, pattern); + for (Object object : objects) { + myProgressIndicator.checkCanceled(); + if (isSetting(object) && settings.size() < 7) { + if (matcher.matches(getSettingText((OptionDescription)object))) { + settings.add(object); + } + } + else if (!isToolWindowAction(object) && isActionValue(object) && actions.size() < 7) { + actions.add((AnAction)((Map.Entry)object).getKey()); + } + } + } + + myProgressIndicator.checkCanceled(); + + UIUtil.invokeAndWaitIfNeeded(new Runnable() { + @Override + public void run() { + if (myProgressIndicator.isCanceled()) return; if (actions.size() > 0) { myTitleIndexes.actions = myListModel.size(); for (Object action : actions) { @@ -1282,12 +1309,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA public void cancel() { myProgressIndicator.cancel(); - } - - public void start() { - if (!myProgressIndicator.isCanceled()) { - ProgressManager.getInstance().runProcess(this, myProgressIndicator); - } + stop(); } } From b783e1e007bafcf0d42c88016d0f06087a947ac7 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 15:25:48 +0200 Subject: [PATCH 03/22] selection color --- .../src/com/intellij/ide/ui/laf/intellijlaf.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties index bbd045209166..04fa6e278cde 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties @@ -1,6 +1,6 @@ # suppress inspection "UnusedProperty" for whole file intellijlaf.background=e8e8e8 -intellijlaf.selectionBackground=4696ff +intellijlaf.selectionBackground=3875D6 intellijlaf.textBackground=cccccc intellijlaf.foreground=000000 intellijlaf.textForeground=000000 @@ -67,7 +67,7 @@ TextField.darcula.search.icon=/com/intellij/ide/ui/laf/icons/search.png TextField.darcula.searchWithHistory.icon=/com/intellij/ide/ui/laf/icons/searchWithHistory.png TextField.darcula.clear.icon=/com/intellij/ide/ui/laf/icons/clear.png -TextArea.selectionForeground=bbbbbb +TextArea.selectionForeground=ffffff TextArea.background=ffffff Panel.background=e8e8e8 From c13aacf9a82610eb4e474426a6952e9c374930bb Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Tue, 22 Oct 2013 17:18:52 +0400 Subject: [PATCH 04/22] IDEA-114427 Using $this in GString marked as invalid (Identifier or code block expected) --- .../groovy/lang/lexer/_GroovyLexer.java | 1412 ++++++++--------- .../plugins/groovy/lang/lexer/groovy.flex | 2 - .../primary/CompoundStringExpression.java | 4 +- .../lang/parser/ExpressionsParsingTest.groovy | 2 + .../groovy/expressions/gstring/this.test | 19 + 5 files changed, 728 insertions(+), 711 deletions(-) create mode 100644 plugins/groovy/testdata/parsing/groovy/expressions/gstring/this.test diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/_GroovyLexer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/_GroovyLexer.java index 4ca2050c945c..707e80f59444 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/_GroovyLexer.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/_GroovyLexer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -/* The following code was generated by JFlex 1.4.3 on 10/22/13 3:36 PM */ +/* The following code was generated by JFlex 1.4.3 on 10/22/13 5:15 PM */ package org.jetbrains.plugins.groovy.lang.lexer; @@ -28,11 +28,9 @@ import java.util.Stack; /** * This class is a scanner generated by * JFlex 1.4.3 - * on 10/22/13 3:36 PM from the specification file + * on 10/22/13 5:15 PM from the specification file * /Users/maxmedvedev/work/IDEA/tools/lexer/../../community/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/groovy.flex */ -@SuppressWarnings({"UnnecessaryFullyQualifiedName", "FieldCanBeLocal", "UnusedDeclaration", "UnusedAssignment", "AccessStaticViaInstance", - "AssignmentToStaticFieldFromInstanceMethod", "MethodMayBeStatic", "CStyleArrayDeclaration", "UnnecessarySemicolon"}) public class _GroovyLexer implements FlexLexer, GroovyTokenTypes, TokenType { /** initial size of the lookahead buffer */ private static final int ZZ_BUFFERSIZE = 16384; @@ -1772,88 +1770,201 @@ public class _GroovyLexer implements FlexLexer, GroovyTokenTypes, TokenType { zzMarkedPos = zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { - case 70: - { yybegin(WAIT_FOR_REGEX); - return(mSPREAD_DOT); + case 58: + { yybegin(IN_DOLLAR_SLASH_REGEX_DOT); + return mIDENT; } case 173: break; - case 27: + case 5: { yybegin(WAIT_FOR_REGEX); - return(mMOD); + return(mSTAR); } case 174: break; - case 46: - { yybegin(NLS_AFTER_NLS); - afterComment = IN_TRIPLE_IDENT; - return mNLS; + case 73: + { yybegin(WAIT_FOR_REGEX); + return(mNOT_EQUAL); } case 175: break; - case 112: - { yybegin(WAIT_FOR_REGEX); - return(mSTAR_STAR_ASSIGN); + case 47: + { blockStack.push(mLCURLY); + braceCount.push(mLCURLY); + yybegin(NLS_AFTER_LBRACE); + return(mLCURLY); } case 176: break; case 133: { return( kTRUE ); } case 177: break; - case 122: - { yybegin(WAIT_FOR_REGEX); - return(mREGEX_MATCH); - } - case 178: break; - case 69: - { yybegin(WAIT_FOR_REGEX); - return(mSTAR_STAR); - } - case 179: break; case 135: { return( kNULL ); } - case 180: break; + case 178: break; + case 23: + { yybegin(WAIT_FOR_REGEX); + return(mCOMMA); + } + case 179: break; case 129: { return( kENUM ); } + case 180: break; + case 61: + { yybegin(IN_DOLLAR_SLASH_REGEX_DOLLAR); + return mDOLLAR; + } case 181: break; - case 53: - { blockStack.push(mDIV); - braceCount.push(mLCURLY); - yybegin(NLS_AFTER_LBRACE); - return mLCURLY; + case 83: + { yybegin(WAIT_FOR_REGEX); + return(mDEC); } case 182: break; - case 55: - { if (!gStringStack.isEmpty()) { - gStringStack.pop(); - } + case 80: + { return( kDO ); + } + case 183: break; + case 86: + { yybegin(WAIT_FOR_REGEX); + return(mRANGE_INCLUSIVE); + } + case 184: break; + case 72: + { return mSH_COMMENT; + } + case 185: break; + case 125: + { yybegin(WAIT_FOR_REGEX); + return(mSR_ASSIGN); + } + case 186: break; + case 52: + { yybegin(IN_REGEX_DOT); + return mIDENT; + } + case 187: break; + case 105: + { yybegin(IN_DOLLAR_SLASH_REGEX); + gStringStack.push(mDOLLAR); + return mDOLLAR_SLASH_REGEX_BEGIN; + } + case 188: break; + case 49: + { yypushback(1); if (blockStack.isEmpty()){ yybegin(YYINITIAL); } else { yybegin(IN_INNER_BLOCK); } - return mREGEX_END; } - case 183: break; - case 62: - { yypushback(1); - yybegin(IN_DOLLAR_SLASH_REGEX); + case 189: break; + case 7: + { return mIDENT; } - case 184: break; - case 80: - { return( kDO ); + case 190: break; + case 25: + { yybegin(WAIT_FOR_REGEX); + return(mGT); } - case 185: break; - case 65: - { yypushback(1); - yybegin(NLS_AFTER_COMMENT); + case 191: break; + case 144: + { return( kSUPER ); } - case 186: break; - case 72: - { return mSH_COMMENT; + case 192: break; + case 119: + { yybegin(IN_TRIPLE_GSTRING); + gStringStack.push(mLBRACK); + return mGSTRING_BEGIN; } - case 187: break; - case 42: - { if (!gStringStack.isEmpty()) { + case 193: break; + case 68: + { yybegin(WAIT_FOR_REGEX); + return(mDIV_ASSIGN); + } + case 194: break; + case 171: + { return( kINSTANCEOF ); + } + case 195: break; + case 93: + { yybegin(WAIT_FOR_REGEX); + return(mEQUAL); + } + case 196: break; + case 18: + { yybegin(WAIT_FOR_REGEX); + braceCount.push(mLPAREN); + return(mLPAREN); + } + case 197: break; + case 22: + { yybegin(WAIT_FOR_REGEX); + return(mCOLON); + } + case 198: break; + case 152: + { return( kSTATIC ); + } + case 199: break; + case 143: + { return( kCATCH ); + } + case 200: break; + case 29: + { yybegin(WAIT_FOR_REGEX); + return(mBOR); + } + case 201: break; + case 54: + { return mREGEX_CONTENT; + } + case 202: break; + case 106: + // lookahead expression with fixed lookahead length + yypushback(1); + { return mREGEX_CONTENT; + } + case 203: break; + case 27: + { yybegin(WAIT_FOR_REGEX); + return(mMOD); + } + case 204: break; + case 24: + { yybegin(WAIT_FOR_REGEX); + return(mLT); + } + case 205: break; + case 168: + { return( kPROTECTED ); + } + case 206: break; + case 113: + { return mNUM_BIG_DECIMAL; + } + case 207: break; + case 70: + { yybegin(WAIT_FOR_REGEX); + return(mSPREAD_DOT); + } + case 208: break; + case 149: + { return( kDOUBLE ); + } + case 209: break; + case 37: + { yybegin(IN_TRIPLE_DOT); + return mIDENT; + } + case 210: break; + case 35: + { blockStack.push(mLPAREN); + braceCount.push(mLCURLY); + yybegin(NLS_AFTER_LBRACE); + return mLCURLY; + } + case 211: break; + case 126: + { if (!gStringStack.isEmpty()){ gStringStack.pop(); } if (blockStack.isEmpty()){ @@ -1863,407 +1974,54 @@ public class _GroovyLexer implements FlexLexer, GroovyTokenTypes, TokenType { } return mGSTRING_END; } - case 188: break; - case 7: - { return mIDENT; - } - case 189: break; - case 88: - { if (zzStartRead == 0 || - zzBuffer.subSequence(0, zzStartRead).toString().trim().length() == 0) { - yypushback(2); - yybegin(WAIT_FOR_REGEX); - } else { - yypushback(1); - return(mDOLLAR); - } - } - case 190: break; - case 144: - { return( kSUPER ); - } - case 191: break; - case 94: - { yybegin(WAIT_FOR_REGEX); - return(mREGEX_FIND); - } - case 192: break; - case 99: - { yybegin(WAIT_FOR_REGEX); - return(mBOR_ASSIGN); - } - case 193: break; - case 171: - { return( kINSTANCEOF ); - } - case 194: break; - case 35: - { blockStack.push(mLPAREN); - braceCount.push(mLCURLY); - yybegin(NLS_AFTER_LBRACE); - return mLCURLY; - } - case 195: break; - case 108: - { if (!gStringStack.isEmpty()) { - gStringStack.pop(); - } - if (blockStack.isEmpty()){ - yybegin(YYINITIAL); - } else { - yybegin(IN_INNER_BLOCK); - } - return mDOLLAR_SLASH_REGEX_END; - } - case 196: break; - case 73: - { yybegin(WAIT_FOR_REGEX); - return(mNOT_EQUAL); - } - case 197: break; - case 103: - // lookahead expression with fixed base length - zzMarkedPos = zzStartRead + 1; - { yybegin(IN_SINGLE_IDENT); - return mDOT; - } - case 198: break; - case 152: - { return( kSTATIC ); - } - case 199: break; - case 100: - { yybegin(WAIT_FOR_REGEX); - return(mLOR); - } - case 200: break; - case 57: - { yypushback(1); - yybegin(IN_REGEX); - } - case 201: break; - case 143: - { return( kCATCH ); - } - case 202: break; - case 54: - { return mREGEX_CONTENT; - } - case 203: break; - case 106: - // lookahead expression with fixed lookahead length - yypushback(1); - { return mREGEX_CONTENT; - } - case 204: break; - case 4: - { if (zzStartRead == 0 || - zzBuffer.subSequence(0, zzStartRead).toString().trim().length() == 0) { - yypushback(1); - yybegin(WAIT_FOR_REGEX); - } else { - return(mDIV); - } - } - case 205: break; - case 97: - { yybegin(WAIT_FOR_REGEX); - return(mMOD_ASSIGN); - } - case 206: break; - case 168: - { return( kPROTECTED ); - } - case 207: break; - case 86: - { yybegin(WAIT_FOR_REGEX); - return(mRANGE_INCLUSIVE); - } - case 208: break; - case 113: - { return mNUM_BIG_DECIMAL; - } - case 209: break; - case 58: - { yybegin(IN_DOLLAR_SLASH_REGEX_DOT); - return mIDENT; - } - case 210: break; - case 25: - { yybegin(WAIT_FOR_REGEX); - return(mGT); - } - case 211: break; - case 33: - { yypushback(1); - yybegin(IN_SINGLE_GSTRING); - } case 212: break; - case 125: - { yybegin(WAIT_FOR_REGEX); - return(mSR_ASSIGN); - } - case 213: break; - case 149: - { return( kDOUBLE ); - } - case 214: break; - case 119: - { yybegin(IN_TRIPLE_GSTRING); - gStringStack.push(mLBRACK); - return mGSTRING_BEGIN; - } - case 215: break; case 121: { return( kNEW ); } - case 216: break; - case 36: - { yypushback(1); - yybegin(IN_TRIPLE_GSTRING); - } - case 217: break; - case 17: - { yybegin(WAIT_FOR_REGEX); - return(mASSIGN); - } - case 218: break; - case 50: - { afterComment = YYINITIAL; - return(WHITE_SPACE); - } - case 219: break; + case 213: break; case 156: { return( kNATIVE ); } - case 220: break; - case 114: - { return( kFOR ); - } - case 221: break; - case 98: - { yybegin(WAIT_FOR_REGEX); - return(mBXOR_ASSIGN); - } - case 222: break; - case 132: - { return( kCHAR ); - } - case 223: break; - case 91: - { yybegin(WAIT_FOR_REGEX); - return(mOPTIONAL_DOT); - } - case 224: break; - case 24: - { yybegin(WAIT_FOR_REGEX); - return(mLT); - } - case 225: break; - case 148: - { return( kIMPORT ); - } - case 226: break; - case 159: - { return( kEXTENDS ); - } - case 227: break; - case 2: - { yybegin(NLS_AFTER_NLS); - afterComment = WAIT_FOR_REGEX; - return !braceCount.isEmpty() && - mLPAREN == braceCount.peek() ? WHITE_SPACE : mNLS; - } - case 228: break; - case 60: - { return mDOLLAR_SLASH_REGEX_CONTENT; - } - case 229: break; - case 109: - // lookahead expression with fixed lookahead length - yypushback(1); - { return mDOLLAR_SLASH_REGEX_CONTENT; - } - case 230: break; - case 63: - { yypushback(1); - yybegin(afterComment); - } - case 231: break; - case 157: - { return( kFINALLY ); - } - case 232: break; - case 82: - { yybegin(WAIT_FOR_REGEX); - return(mPLUS_ASSIGN); - } - case 233: break; - case 136: - { return( kVOID ); - } - case 234: break; - case 150: - { return( kPUBLIC ); - } - case 235: break; - case 128: - { return( kELSE ); - } - case 236: break; - case 12: - { return mSTRING_LITERAL; - } - case 237: break; - case 6: - { yybegin(WAIT_FOR_REGEX); - return(mLNOT); - } - case 238: break; - case 10: - { yybegin(WAIT_FOR_REGEX); - return(mMINUS); - } - case 239: break; - case 64: - { yypushback(1); - yybegin(WAIT_FOR_REGEX); - } - case 240: break; - case 59: - { blockStack.push(mDOLLAR); - braceCount.push(mLCURLY); - yybegin(NLS_AFTER_LBRACE); - return mLCURLY; - } - case 241: break; - case 30: - { yybegin(WAIT_FOR_REGEX); - return(mBAND); - } - case 242: break; - case 170: - { return( kIMPLEMENTS ); - } - case 243: break; - case 5: - { yybegin(WAIT_FOR_REGEX); - return(mSTAR); - } - case 244: break; - case 11: - { yybegin(WAIT_FOR_REGEX); - return(mDOT); - } - case 245: break; - case 8: - { return mNUM_INT; - } - case 246: break; - case 167: - { return( kINTERFACE ); - } - case 247: break; - case 81: - { yybegin(WAIT_FOR_REGEX); - return(mINC); - } - case 248: break; - case 161: - { return( kPACKAGE ); - } - case 249: break; - case 146: - { return( kTHROW ); - } - case 250: break; - case 92: - { yybegin(WAIT_FOR_REGEX); - return(mELVIS); - } - case 251: break; - case 79: - { return( kIN ); - } - case 252: break; - case 84: - { yybegin(WAIT_FOR_REGEX); - return(mMINUS_ASSIGN); - } - case 253: break; - case 66: - { return mSL_COMMENT; - } - case 254: break; - case 37: - { yybegin(IN_TRIPLE_DOT); - return mIDENT; - } - case 255: break; - case 20: - { yybegin(WAIT_FOR_REGEX); - braceCount.push(mLPAREN); - return(mLBRACK); - } - case 256: break; - case 130: - { return( kBYTE ); - } - case 257: break; - case 137: - { yybegin(WAIT_FOR_REGEX); - return(mBSR_ASSIGN); - } - case 258: break; - case 52: - { yybegin(IN_REGEX_DOT); - return mIDENT; - } - case 259: break; - case 44: - { yybegin(IN_TRIPLE_GSTRING_DOLLAR); - return mDOLLAR; - } - case 260: break; - case 49: - { yypushback(1); - if (blockStack.isEmpty()){ - yybegin(YYINITIAL); - } else { - yybegin(IN_INNER_BLOCK); - } - } - case 261: break; - case 172: - { return( kSYNCHRONIZED ); - } - case 262: break; - case 117: - { yybegin(WAIT_FOR_REGEX); - return(mTRIPLE_DOT); - } - case 263: break; - case 85: - { yybegin(WAIT_FOR_REGEX); - return(mCLOSABLE_BLOCK_OP); - } - case 264: break; + case 214: break; case 87: { yybegin(WAIT_FOR_REGEX); return(mMEMBER_POINTER); } - case 265: break; - case 120: - { return( kTRY ); - } - case 266: break; - case 21: + case 215: break; + case 19: { if (!braceCount.isEmpty() && mLPAREN == braceCount.peek()) { braceCount.pop(); } - return(mRBRACK); + return(mRPAREN); } - case 267: break; + case 216: break; + case 64: + { yypushback(1); + yybegin(WAIT_FOR_REGEX); + } + case 217: break; + case 114: + { return( kFOR ); + } + case 218: break; + case 132: + { return( kCHAR ); + } + case 219: break; + case 148: + { return( kIMPORT ); + } + case 220: break; + case 91: + { yybegin(WAIT_FOR_REGEX); + return(mOPTIONAL_DOT); + } + case 221: break; + case 101: + { yybegin(WAIT_FOR_REGEX); + return(mBAND_ASSIGN); + } + case 222: break; case 48: { if (!blockStack.isEmpty()) { IElementType br = blockStack.pop(); @@ -2280,21 +2038,117 @@ public class _GroovyLexer implements FlexLexer, GroovyTokenTypes, TokenType { } return mRCURLY; } - case 268: break; - case 131: - { return( kCASE ); + case 223: break; + case 159: + { return( kEXTENDS ); } - case 269: break; - case 77: - { return mNUM_DOUBLE; + case 224: break; + case 9: + { yybegin(WAIT_FOR_REGEX); + return(mPLUS); } - case 270: break; - case 158: - { return( kDEFAULT ); + case 225: break; + case 108: + { if (!gStringStack.isEmpty()) { + gStringStack.pop(); + } + if (blockStack.isEmpty()){ + yybegin(YYINITIAL); + } else { + yybegin(IN_INNER_BLOCK); + } + return mDOLLAR_SLASH_REGEX_END; } - case 271: break; - case 126: - { if (!gStringStack.isEmpty()){ + case 226: break; + case 94: + { yybegin(WAIT_FOR_REGEX); + return(mREGEX_FIND); + } + case 227: break; + case 26: + { yybegin(WAIT_FOR_REGEX); + return(mBNOT); + } + case 228: break; + case 60: + { return mDOLLAR_SLASH_REGEX_CONTENT; + } + case 229: break; + case 109: + // lookahead expression with fixed lookahead length + yypushback(1); + { return mDOLLAR_SLASH_REGEX_CONTENT; + } + case 230: break; + case 99: + { yybegin(WAIT_FOR_REGEX); + return(mBOR_ASSIGN); + } + case 231: break; + case 157: + { return( kFINALLY ); + } + case 232: break; + case 100: + { yybegin(WAIT_FOR_REGEX); + return(mLOR); + } + case 233: break; + case 71: + { yybegin(WAIT_FOR_REGEX); + return(mSTAR_ASSIGN); + } + case 234: break; + case 136: + { return( kVOID ); + } + case 235: break; + case 150: + { return( kPUBLIC ); + } + case 236: break; + case 128: + { return( kELSE ); + } + case 237: break; + case 38: + { blockStack.push(mLBRACK); + braceCount.push(mLCURLY); + yybegin(NLS_AFTER_LBRACE); + return mLCURLY; + } + case 238: break; + case 12: + { return mSTRING_LITERAL; + } + case 239: break; + case 88: + { if (zzStartRead == 0 || + zzBuffer.subSequence(0, zzStartRead).toString().trim().length() == 0) { + yypushback(2); + yybegin(WAIT_FOR_REGEX); + } else { + yypushback(1); + return(mDOLLAR); + } + } + case 240: break; + case 84: + { yybegin(WAIT_FOR_REGEX); + return(mMINUS_ASSIGN); + } + case 241: break; + case 85: + { yybegin(WAIT_FOR_REGEX); + return(mCLOSABLE_BLOCK_OP); + } + case 242: break; + case 170: + { return( kIMPLEMENTS ); + } + case 243: break; + case 42: + { if (!gStringStack.isEmpty()) { gStringStack.pop(); } if (blockStack.isEmpty()){ @@ -2304,306 +2158,451 @@ public class _GroovyLexer implements FlexLexer, GroovyTokenTypes, TokenType { } return mGSTRING_END; } - case 272: break; - case 169: - { return( kTRANSIENT ); + case 244: break; + case 97: + { yybegin(WAIT_FOR_REGEX); + return(mMOD_ASSIGN); } - case 273: break; - case 111: - { return GROOVY_DOC_COMMENT; - } - case 274: break; + case 245: break; case 16: { yybegin(WAIT_FOR_REGEX); return(mQUESTION); } + case 246: break; + case 8: + { return mNUM_INT; + } + case 247: break; + case 167: + { return( kINTERFACE ); + } + case 248: break; + case 31: + { yybegin(WAIT_FOR_REGEX); + return(mSEMI); + } + case 249: break; + case 161: + { return( kPACKAGE ); + } + case 250: break; + case 146: + { return( kTHROW ); + } + case 251: break; + case 17: + { yybegin(WAIT_FOR_REGEX); + return(mASSIGN); + } + case 252: break; + case 79: + { return( kIN ); + } + case 253: break; + case 66: + { return mSL_COMMENT; + } + case 254: break; + case 13: + { yybegin(IN_SINGLE_GSTRING); + gStringStack.push(mLPAREN); + return mGSTRING_BEGIN; + } + case 255: break; + case 130: + { return( kBYTE ); + } + case 256: break; + case 102: + { yybegin(WAIT_FOR_REGEX); + return(mLAND); + } + case 257: break; + case 33: + { yypushback(1); + yybegin(IN_SINGLE_GSTRING); + } + case 258: break; + case 28: + { yybegin(WAIT_FOR_REGEX); + return(mBXOR); + } + case 259: break; + case 57: + { yypushback(1); + yybegin(IN_REGEX); + } + case 260: break; + case 63: + { yypushback(1); + yybegin(afterComment); + } + case 261: break; + case 172: + { return( kSYNCHRONIZED ); + } + case 262: break; + case 124: + { yybegin(WAIT_FOR_REGEX); + return(mSL_ASSIGN); + } + case 263: break; + case 56: + { yybegin(IN_REGEX_DOLLAR); + return mDOLLAR; + } + case 264: break; + case 36: + { yypushback(1); + yybegin(IN_TRIPLE_GSTRING); + } + case 265: break; + case 120: + { return( kTRY ); + } + case 266: break; + case 10: + { yybegin(WAIT_FOR_REGEX); + return(mMINUS); + } + case 267: break; + case 11: + { yybegin(WAIT_FOR_REGEX); + return(mDOT); + } + case 268: break; + case 131: + { return( kCASE ); + } + case 269: break; + case 103: + // lookahead expression with fixed base length + zzMarkedPos = zzStartRead + 1; + { yybegin(IN_SINGLE_IDENT); + return mDOT; + } + case 270: break; + case 77: + { return mNUM_DOUBLE; + } + case 271: break; + case 158: + { return( kDEFAULT ); + } + case 272: break; + case 122: + { yybegin(WAIT_FOR_REGEX); + return(mREGEX_MATCH); + } + case 273: break; + case 50: + { afterComment = YYINITIAL; + return(WHITE_SPACE); + } + case 274: break; + case 169: + { return( kTRANSIENT ); + } case 275: break; + case 81: + { yybegin(WAIT_FOR_REGEX); + return(mINC); + } + case 276: break; + case 111: + { return GROOVY_DOC_COMMENT; + } + case 277: break; + case 2: + { yybegin(NLS_AFTER_NLS); + afterComment = WAIT_FOR_REGEX; + return !braceCount.isEmpty() && + mLPAREN == braceCount.peek() ? WHITE_SPACE : mNLS; + } + case 278: break; + case 59: + { blockStack.push(mDOLLAR); + braceCount.push(mLCURLY); + yybegin(NLS_AFTER_LBRACE); + return mLCURLY; + } + case 279: break; case 153: { return( kSWITCH ); } - case 276: break; + case 280: break; + case 15: + { while (!braceCount.isEmpty() && mLCURLY != braceCount.peek()) { + braceCount.pop(); + } + if (!braceCount.isEmpty() && mLCURLY == braceCount.peek()) { + braceCount.pop(); + } + return mRCURLY; + } + case 281: break; + case 4: + { if (zzStartRead == 0 || + zzBuffer.subSequence(0, zzStartRead).toString().trim().length() == 0) { + yypushback(1); + yybegin(WAIT_FOR_REGEX); + } else { + return(mDIV); + } + } + case 282: break; + case 89: + { return mGSTRING_LITERAL; + } + case 283: break; + case 20: + { yybegin(WAIT_FOR_REGEX); + braceCount.push(mLPAREN); + return(mLBRACK); + } + case 284: break; + case 45: + { yypushback(1); + yybegin(IN_TRIPLE_IDENT); + } + case 285: break; + case 138: + { return( kFLOAT ); + } + case 286: break; + case 137: + { yybegin(WAIT_FOR_REGEX); + return(mBSR_ASSIGN); + } + case 287: break; + case 78: + { return( kIF ); + } + case 288: break; + case 92: + { yybegin(WAIT_FOR_REGEX); + return(mELVIS); + } + case 289: break; + case 139: + { return( kFINAL ); + } + case 290: break; + case 34: + { yybegin(IN_SINGLE_DOT); + return mIDENT; + } + case 291: break; + case 96: + { yybegin(WAIT_FOR_REGEX); + return(mGE); + } + case 292: break; + case 154: + { return( kTHROWS ); + } + case 293: break; case 110: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; { yybegin(IN_DOLLAR_SLASH_REGEX_IDENT); return mDOT; } - case 277: break; - case 89: - { return mGSTRING_LITERAL; - } - case 278: break; - case 124: - { yybegin(WAIT_FOR_REGEX); - return(mSL_ASSIGN); - } - case 279: break; - case 138: - { return( kFLOAT ); - } - case 280: break; - case 105: - { yybegin(IN_DOLLAR_SLASH_REGEX); - gStringStack.push(mDOLLAR); - return mDOLLAR_SLASH_REGEX_BEGIN; - } - case 281: break; - case 45: - { yypushback(1); - yybegin(IN_TRIPLE_IDENT); - } - case 282: break; - case 34: - { yybegin(IN_SINGLE_DOT); - return mIDENT; - } - case 283: break; - case 123: - { yybegin(WAIT_FOR_REGEX); - return(mCOMPARE_TO); - } - case 284: break; - case 78: - { return( kIF ); - } - case 285: break; - case 139: - { return( kFINAL ); - } - case 286: break; - case 101: - { yybegin(WAIT_FOR_REGEX); - return(mBAND_ASSIGN); - } - case 287: break; - case 154: - { return( kTHROWS ); - } - case 288: break; + case 294: break; case 75: { return mNUM_FLOAT; } - case 289: break; - case 38: - { blockStack.push(mLBRACK); - braceCount.push(mLCURLY); - yybegin(NLS_AFTER_LBRACE); - return mLCURLY; + case 295: break; + case 117: + { yybegin(WAIT_FOR_REGEX); + return(mTRIPLE_DOT); } - case 290: break; - case 47: - { blockStack.push(mLCURLY); - braceCount.push(mLCURLY); - yybegin(NLS_AFTER_LBRACE); - return(mLCURLY); - } - case 291: break; + case 296: break; case 115: { return( kINT ); } - case 292: break; + case 297: break; case 165: { return( kSTRICTFP ); } - case 293: break; - case 9: - { yybegin(WAIT_FOR_REGEX); - return(mPLUS); + case 298: break; + case 65: + { yypushback(1); + yybegin(NLS_AFTER_COMMENT); } - case 294: break; + case 299: break; case 163: { return( kABSTRACT ); } - case 295: break; + case 300: break; case 140: { return( kFALSE ); } - case 296: break; - case 41: - { yybegin(IN_SINGLE_GSTRING_DOLLAR); - return mDOLLAR; - } - case 297: break; - case 26: - { yybegin(WAIT_FOR_REGEX); - return(mBNOT); - } - case 298: break; - case 13: - { yybegin(IN_SINGLE_GSTRING); - gStringStack.push(mLPAREN); - return mGSTRING_BEGIN; - } - case 299: break; + case 301: break; case 90: { return( kAS ); } - case 300: break; - case 71: - { yybegin(WAIT_FOR_REGEX); - return(mSTAR_ASSIGN); - } - case 301: break; - case 164: - { return( kCONTINUE ); - } case 302: break; - case 40: - { clearStacks(); - yybegin(NLS_AFTER_NLS); - afterComment = YYINITIAL; + case 46: + { yybegin(NLS_AFTER_NLS); + afterComment = IN_TRIPLE_IDENT; return mNLS; } case 303: break; - case 127: - { return( kLONG ); - } - case 304: break; - case 76: - { return mNUM_LONG; - } - case 305: break; - case 141: - { return( kBREAK ); - } - case 306: break; - case 160: - { return( kBOOLEAN ); - } - case 307: break; - case 151: - { return( kASSERT ); - } - case 308: break; - case 96: - { yybegin(WAIT_FOR_REGEX); - return(mGE); - } - case 309: break; - case 23: - { yybegin(WAIT_FOR_REGEX); - return(mCOMMA); - } - case 310: break; - case 93: - { yybegin(WAIT_FOR_REGEX); - return(mEQUAL); - } - case 311: break; - case 3: - { return WHITE_SPACE; - } - case 312: break; - case 134: - { return( kTHIS ); - } - case 313: break; - case 162: - { return( kPRIVATE ); - } - case 314: break; - case 18: - { yybegin(WAIT_FOR_REGEX); - braceCount.push(mLPAREN); - return(mLPAREN); - } - case 315: break; - case 104: - // lookahead expression with fixed base length - zzMarkedPos = zzStartRead + 1; - { yybegin(IN_TRIPLE_NLS); - return mDOT; - } - case 316: break; - case 51: - { yybegin(IN_REGEX); - gStringStack.push(mDIV); - return mREGEX_BEGIN; - } - case 317: break; - case 145: - { return( kSHORT ); - } - case 318: break; - case 83: - { yybegin(WAIT_FOR_REGEX); - return(mDEC); - } - case 319: break; - case 31: - { yybegin(WAIT_FOR_REGEX); - return(mSEMI); - } - case 320: break; - case 61: - { yybegin(IN_DOLLAR_SLASH_REGEX_DOLLAR); - return mDOLLAR; - } - case 321: break; - case 166: - { return( kVOLATILE ); - } - case 322: break; - case 14: - { yybegin(NLS_AFTER_LBRACE); - braceCount.push(mLCURLY); - return(mLCURLY); - } - case 323: break; - case 32: - { yybegin(WAIT_FOR_REGEX); - return(mAT); - } - case 324: break; - case 74: - { return mNUM_BIG_INT; - } - case 325: break; case 118: { yybegin(WAIT_FOR_REGEX); return(mRANGE_EXCLUSIVE); } - case 326: break; - case 142: - { return( kCLASS ); + case 304: break; + case 164: + { return( kCONTINUE ); } - case 327: break; - case 68: + case 305: break; + case 32: { yybegin(WAIT_FOR_REGEX); - return(mDIV_ASSIGN); + return(mAT); } - case 328: break; + case 306: break; + case 127: + { return( kLONG ); + } + case 307: break; + case 76: + { return mNUM_LONG; + } + case 308: break; + case 141: + { return( kBREAK ); + } + case 309: break; case 95: { yybegin(WAIT_FOR_REGEX); return(mLE); } - case 329: break; - case 155: - { return( kRETURN ); + case 310: break; + case 160: + { return( kBOOLEAN ); } - case 330: break; - case 22: - { yybegin(WAIT_FOR_REGEX); - return(mCOLON); + case 311: break; + case 151: + { return( kASSERT ); } - case 331: break; + case 312: break; case 107: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; { yybegin(IN_REGEX_IDENT); return mDOT; } - case 332: break; - case 56: - { yybegin(IN_REGEX_DOLLAR); + case 313: break; + case 3: + { return WHITE_SPACE; + } + case 314: break; + case 134: + { return( kTHIS ); + } + case 315: break; + case 51: + { yybegin(IN_REGEX); + gStringStack.push(mDIV); + return mREGEX_BEGIN; + } + case 316: break; + case 162: + { return( kPRIVATE ); + } + case 317: break; + case 44: + { yybegin(IN_TRIPLE_GSTRING_DOLLAR); return mDOLLAR; } - case 333: break; - case 19: + case 318: break; + case 145: + { return( kSHORT ); + } + case 319: break; + case 21: { if (!braceCount.isEmpty() && mLPAREN == braceCount.peek()) { braceCount.pop(); } - return(mRPAREN); + return(mRBRACK); + } + case 320: break; + case 14: + { yybegin(NLS_AFTER_LBRACE); + braceCount.push(mLCURLY); + return(mLCURLY); + } + case 321: break; + case 166: + { return( kVOLATILE ); + } + case 322: break; + case 104: + // lookahead expression with fixed base length + zzMarkedPos = zzStartRead + 1; + { yybegin(IN_TRIPLE_NLS); + return mDOT; + } + case 323: break; + case 6: + { yybegin(WAIT_FOR_REGEX); + return(mLNOT); + } + case 324: break; + case 69: + { yybegin(WAIT_FOR_REGEX); + return(mSTAR_STAR); + } + case 325: break; + case 74: + { return mNUM_BIG_INT; + } + case 326: break; + case 55: + { if (!gStringStack.isEmpty()) { + gStringStack.pop(); + } + if (blockStack.isEmpty()){ + yybegin(YYINITIAL); + } else { + yybegin(IN_INNER_BLOCK); + } + return mREGEX_END; + } + case 327: break; + case 142: + { return( kCLASS ); + } + case 328: break; + case 82: + { yybegin(WAIT_FOR_REGEX); + return(mPLUS_ASSIGN); + } + case 329: break; + case 30: + { yybegin(WAIT_FOR_REGEX); + return(mBAND); + } + case 330: break; + case 62: + { yypushback(1); + yybegin(IN_DOLLAR_SLASH_REGEX); + } + case 331: break; + case 123: + { yybegin(WAIT_FOR_REGEX); + return(mCOMPARE_TO); + } + case 332: break; + case 98: + { yybegin(WAIT_FOR_REGEX); + return(mBXOR_ASSIGN); + } + case 333: break; + case 155: + { return( kRETURN ); } case 334: break; case 43: @@ -2634,33 +2633,32 @@ public class _GroovyLexer implements FlexLexer, GroovyTokenTypes, TokenType { { return mGSTRING_CONTENT; } case 336: break; - case 102: + case 112: { yybegin(WAIT_FOR_REGEX); - return(mLAND); + return(mSTAR_STAR_ASSIGN); } case 337: break; - case 29: - { yybegin(WAIT_FOR_REGEX); - return(mBOR); - } - case 338: break; case 116: { return( kDEF ); } + case 338: break; + case 41: + { yybegin(IN_SINGLE_GSTRING_DOLLAR); + return mDOLLAR; + } case 339: break; - case 28: - { yybegin(WAIT_FOR_REGEX); - return(mBXOR); + case 40: + { clearStacks(); + yybegin(NLS_AFTER_NLS); + afterComment = YYINITIAL; + return mNLS; } case 340: break; - case 15: - { while (!braceCount.isEmpty() && mLCURLY != braceCount.peek()) { - braceCount.pop(); - } - if (!braceCount.isEmpty() && mLCURLY == braceCount.peek()) { - braceCount.pop(); - } - return mRCURLY; + case 53: + { blockStack.push(mDIV); + braceCount.push(mLCURLY); + yybegin(NLS_AFTER_LBRACE); + return mLCURLY; } case 341: break; case 147: diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/groovy.flex b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/groovy.flex index 7da98135420a..6979286324ec 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/groovy.flex +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/lexer/groovy.flex @@ -22,8 +22,6 @@ import java.util.*; %% -%{@SuppressWarnings({"UnnecessaryFullyQualifiedName", "FieldCanBeLocal", "UnusedDeclaration", "UnusedAssignment", "AccessStaticViaInstance", - "AssignmentToStaticFieldFromInstanceMethod", "MethodMayBeStatic", "CStyleArrayDeclaration", "UnnecessarySemicolon"}) %} %class _GroovyLexer %implements FlexLexer, GroovyTokenTypes, TokenType %unicode diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/CompoundStringExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/CompoundStringExpression.java index e9f72ad055b4..00f457cc691e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/CompoundStringExpression.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/expressions/primary/CompoundStringExpression.java @@ -143,10 +143,10 @@ public class CompoundStringExpression implements GroovyElementTypes { final PsiBuilder.Marker injection = myBuilder.mark(); ParserUtils.getToken(myBuilder, mDOLLAR); - if (mIDENT.equals(myBuilder.getTokenType())) { + if (myBuilder.getTokenType() == mIDENT || myBuilder.getTokenType() == kTHIS) { PathExpression.parse(myBuilder, myParser); } - else if (mLCURLY.equals(myBuilder.getTokenType())) { + else if (myBuilder.getTokenType() == mLCURLY) { OpenOrClosableBlock.parseClosableBlock(myBuilder, myParser); } else { diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/ExpressionsParsingTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/ExpressionsParsingTest.groovy index e247073209d1..7e9e03c60731 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/ExpressionsParsingTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/ExpressionsParsingTest.groovy @@ -148,6 +148,8 @@ public class ExpressionsParsingTest extends GroovyParsingTestCase { public void testgstring$ugly_lexer() throws Throwable { doTest(); } + public void testgstring$this() {doTest()} + public void testmapLiteral() throws Throwable { doTest(); } public void testnew$arr_decl() throws Throwable { doTest(); } diff --git a/plugins/groovy/testdata/parsing/groovy/expressions/gstring/this.test b/plugins/groovy/testdata/parsing/groovy/expressions/gstring/this.test new file mode 100644 index 000000000000..66e1181d358c --- /dev/null +++ b/plugins/groovy/testdata/parsing/groovy/expressions/gstring/this.test @@ -0,0 +1,19 @@ +print "abc $this.prop test" +----- +Groovy script + Call expression + Reference expression + PsiElement(identifier)('print') + PsiWhiteSpace(' ') + Command arguments + Compound Gstring + PsiElement(Gstring begin)('"') + GrStringContentImpl(GString content element) + PsiElement(Gstring content)('abc ') + GString injection + PsiElement($)('$') + Reference expression + PsiElement(this)('this') + GrStringContentImpl(GString content element) + PsiElement(Gstring content)('.prop test') + PsiElement(Gstring end)('"') \ No newline at end of file From 26020322fa9d95c69baee8930528c9ef092eb21e Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Tue, 22 Oct 2013 17:29:52 +0400 Subject: [PATCH 05/22] IDEA-114409 Wrong type inference in Groovy takeWhile on List --- .../lang/psi/typeEnhancers/ClosureParameterEnhancer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ClosureParameterEnhancer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ClosureParameterEnhancer.java index cd65ac2f629f..6266c823e185 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ClosureParameterEnhancer.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ClosureParameterEnhancer.java @@ -84,7 +84,6 @@ public class ClosureParameterEnhancer extends AbstractClosureParameterEnhancer { simpleTypes.put("replaceAll", "java.util.regex.Matcher"); simpleTypes.put("replaceFirst", "java.util.regex.Matcher"); simpleTypes.put("splitEachLine", "java.util.List"); - simpleTypes.put("takeWhile", "java.lang.Character"); iterations.add("each"); iterations.add("any"); @@ -104,6 +103,8 @@ public class ClosureParameterEnhancer extends AbstractClosureParameterEnhancer { iterations.add("findIndexValues"); iterations.add("findIndexOf"); iterations.add("count"); + iterations.add("takeWhile"); + } @Override From e62b8de18928e0860ef9e8762bc2764546e9837c Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Tue, 22 Oct 2013 17:37:44 +0400 Subject: [PATCH 06/22] IDEA-114703 Groovy: "Unnecessary qualified reference" quick fix could be renamed --- .../codeInspection/GroovyInspectionBundle.properties | 3 ++- .../UnnecessaryQualifiedReferenceInspection.java | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties index 5a9566f10765..5ccb19b400aa 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties @@ -105,4 +105,5 @@ add.to.resources=Add to resources add.type.customizer.to.resources=Add type customizer script to resources target.0.does.not.exist=Target ''{0}'' does not exist target.annotation.is.unused=@Target is unused -change.lvalue.type=Change variable ''{0}'' type to ''{1}'' \ No newline at end of file +change.lvalue.type=Change variable ''{0}'' type to ''{1}'' +replace.qualified.name.with.import=Replace qualified name with import \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/UnnecessaryQualifiedReferenceInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/UnnecessaryQualifiedReferenceInspection.java index 3383cbb6151c..49ec3ceede6e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/UnnecessaryQualifiedReferenceInspection.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/UnnecessaryQualifiedReferenceInspection.java @@ -50,6 +50,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement; public class UnnecessaryQualifiedReferenceInspection extends BaseInspection { private static final Logger LOG = Logger.getInstance(UnnecessaryQualifiedReferenceInspection.class); + @NotNull @Override protected BaseInspectionVisitor buildVisitor() { return new BaseInspectionVisitor() { @@ -84,7 +85,10 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection { final PsiElement parent = ref.getParent(); if (parent instanceof GrMethodCall) { final GrMethodCall copy = (GrMethodCall)parent.copy(); - ((GrReferenceExpression)copy.getInvokedExpression()).setQualifier(null); + GrReferenceExpression invoked = (GrReferenceExpression)copy.getInvokedExpression(); + assert invoked != null; + + invoked.setQualifier(null); copyResolved = ((GrReferenceExpression)copy.getInvokedExpression()).resolve(); } @@ -116,7 +120,7 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection { } @Override - protected GroovyFix buildFix(PsiElement location) { + protected GroovyFix buildFix(@NotNull PsiElement location) { return new GroovyFix() { @Override protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException { @@ -128,7 +132,7 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection { @NotNull @Override public String getName() { - return GroovyInspectionBundle.message("unnecessary.qualified.reference"); + return GroovyInspectionBundle.message("replace.qualified.name.with.import"); } }; } From 41e1124a9c0b48fd29eb52f535981c514b8a439a Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 15:49:53 +0200 Subject: [PATCH 07/22] rewrite using pooled thread --- .../ide/actions/SearchEverywhereAction.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 8bd09ac95b36..402f23a511a4 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -793,7 +793,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } @SuppressWarnings("SSBasedInspection") - private class CalcThread extends Thread { + private class CalcThread implements Runnable { private final Project project; private final String pattern; private ProgressIndicator myProgressIndicator = new ProgressIndicatorBase(); @@ -1026,7 +1026,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } private void buildRecentFiles(String pattern) { - final MinusculeMatcher matcher = new MinusculeMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE); + final MinusculeMatcher matcher = new MinusculeMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE); final ArrayList files = new ArrayList(); for (VirtualFile file : ArrayUtil.reverseArray(EditorHistoryManager.getInstance(project).getFiles())) { if (StringUtil.isEmptyOrSpaces(pattern) || matcher.matches(file.getName())) { @@ -1190,10 +1190,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA myRenderer.recalculateWidth(); if (myPopup == null || !myPopup.isVisible()) { - //final Font editorFont = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN); - //myList.setFont(editorFont); - //getField().getTextEditor().setFont(editorFont); - //More.instance.label.setFont(editorFont); final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList); final ComponentPopupBuilder builder = JBPopupFactory.getInstance() .createComponentPopupBuilder(new JBScrollPane(myList), null); @@ -1277,7 +1273,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA MatchResult result; for (String name : names) { - //myProgressIndicator.checkCanceled(); + myProgressIndicator.checkCanceled(); result = null; if (model instanceof CustomMatcherModel) { try { @@ -1309,7 +1305,10 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA public void cancel() { myProgressIndicator.cancel(); - stop(); + } + + public void start() { + ApplicationManager.getApplication().executeOnPooledThread(this); } } From 0024f74f9bcb1277d8aa286092c6398698fa9111 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 22 Oct 2013 17:56:02 +0400 Subject: [PATCH 08/22] relax types --- .../src/com/intellij/util/xml/GenericValueUtil.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java index 6085c20e7542..d83c043b042f 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java @@ -22,7 +22,6 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.util.Collection; -import java.util.List; /** * @author Gregory.Shrago @@ -43,15 +42,15 @@ public class GenericValueUtil { }; - public static boolean containsString(final List> list, String value) { - for (GenericValue o : list) { + public static boolean containsString(final Collection> collection, String value) { + for (GenericValue o : collection) { if (Comparing.equal(value, o.getStringValue())) return true; } return false; } - public static boolean containsValue(final List> list, T value) { - for (GenericValue o : list) { + public static boolean containsValue(final Collection> collection, T value) { + for (GenericValue o : collection) { if (Comparing.equal(value, o.getValue())) return true; } return false; From b3318975f9714cf2570d245bedbb0fb77f48d861 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 22 Oct 2013 13:22:16 +0200 Subject: [PATCH 09/22] extract interface: allow to pull up default implementations implicitly (IDEA-114918) --- .../extractInterface/ExtractInterfaceDialog.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceDialog.java b/java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceDialog.java index c94321e00223..b07cb31c92b0 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceDialog.java @@ -17,6 +17,7 @@ package com.intellij.refactoring.extractInterface; import com.intellij.openapi.project.Project; import com.intellij.psi.*; +import com.intellij.psi.util.PsiUtil; import com.intellij.refactoring.HelpID; import com.intellij.refactoring.JavaRefactoringSettings; import com.intellij.refactoring.RefactoringBundle; @@ -37,6 +38,9 @@ class ExtractInterfaceDialog extends JavaExtractSuperBaseDialog { public ExtractInterfaceDialog(Project project, PsiClass sourceClass) { super(project, sourceClass, collectMembers(sourceClass), ExtractInterfaceHandler.REFACTORING_NAME); + for (MemberInfo memberInfo : myMemberInfos) { + memberInfo.setToAbstract(true); + } init(); } @@ -85,7 +89,7 @@ class ExtractInterfaceDialog extends JavaExtractSuperBaseDialog { protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); final MemberSelectionPanel memberSelectionPanel = new MemberSelectionPanel(RefactoringBundle.message("members.to.form.interface"), - myMemberInfos, null); + myMemberInfos, RefactoringBundle.message("make.abstract")); memberSelectionPanel.getTable() .setMemberInfoModel(new DelegatingMemberInfoModel(memberSelectionPanel.getTable().getMemberInfoModel()) { public Boolean isFixedAbstract(MemberInfo member) { From 5ca293d81750ae4d1258ed0bb14370643ab14fb6 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 22 Oct 2013 13:53:00 +0200 Subject: [PATCH 10/22] EA-51245 - IAE: InspectionEP.getLocalizedString --- .../src/com/intellij/codeInspection/InspectionEP.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/analysis-api/src/com/intellij/codeInspection/InspectionEP.java b/platform/analysis-api/src/com/intellij/codeInspection/InspectionEP.java index 20972dbc886b..9b794fe44f79 100644 --- a/platform/analysis-api/src/com/intellij/codeInspection/InspectionEP.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/InspectionEP.java @@ -130,9 +130,12 @@ public class InspectionEP extends LanguageExtensionPoint implements InspectionPr public boolean hasStaticDescription; @Nullable - private String getLocalizedString(String bundleName, @NotNull String key) { + private String getLocalizedString(String bundleName, String key) { final String baseName = bundleName != null ? bundleName : bundle == null ? ((IdeaPluginDescriptor)myPluginDescriptor).getResourceBundleBaseName() : bundle; - if (baseName == null) { + if (baseName == null || key == null) { + if (bundleName != null) { + LOG.warn(implementationClass); + } return null; } final ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(baseName, myPluginDescriptor.getPluginClassLoader()); From 15523e7e975d86b6f85f7d41f5befa6858549a95 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 22 Oct 2013 14:29:01 +0200 Subject: [PATCH 11/22] plugins advertisement: suggest to enable disabled plugins --- .../PluginsAdvertiser.java | 20 ++++++++++------- .../PluginsAdvertiserDialog.java | 22 +++++++++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java index 934de59ec8c2..80011b284c7b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java @@ -20,6 +20,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.stream.JsonReader; import com.intellij.ide.plugins.IdeaPluginDescriptor; +import com.intellij.ide.plugins.PluginManager; import com.intellij.ide.plugins.PluginManagerCore; import com.intellij.ide.plugins.RepositoryHelper; import com.intellij.notification.*; @@ -177,21 +178,24 @@ public class PluginsAdvertiser implements StartupActivity { indicator.setText("Searching for plugin supporting \'" + feature.getImplementationName() + "\'"); final List pluginId = retrieve(feature); if (pluginId != null) { - //do not suggest to download disabled plugins - final List disabledPlugins = PluginManagerCore.getDisabledPlugins(); - for (PluginId id : pluginId) { - if (!disabledPlugins.contains(id.getIdString())) { - ids.add(id); - } - } + ids.addAll(pluginId); } indicator.setFraction(((double) idx++) / unknownFeatures.size()); } try { + final List disabledPlugins = PluginManagerCore.getDisabledPlugins(); + //include disabled plugins + for (PluginId id : ids) { + final IdeaPluginDescriptor plugin = PluginManager.getPlugin(id); + if (plugin != null) { + myPlugins.add(PluginDownloader.createDownloader(plugin)); + } + } myAllPlugins = RepositoryHelper.loadPluginsFromRepository(indicator); for (IdeaPluginDescriptor loadedPlugin : myAllPlugins) { - if (ids.contains(loadedPlugin.getPluginId())) { + final PluginId pluginId = loadedPlugin.getPluginId(); + if (ids.contains(pluginId) && !disabledPlugins.contains(pluginId.getIdString())) { myPlugins.add(PluginDownloader.createDownloader(loadedPlugin)); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java index a092d2a5b850..8b7d148f2012 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java @@ -15,10 +15,9 @@ */ package com.intellij.openapi.updateSettings.impl.pluginsAdvertisement; -import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.ide.plugins.PluginManagerMain; -import com.intellij.ide.plugins.PluginNode; +import com.intellij.ide.plugins.*; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.extensions.PluginId; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.updateSettings.impl.DetectedPluginsPanel; @@ -47,7 +46,7 @@ public class PluginsAdvertiserDialog extends DialogWrapper { super(project); myUploadedPlugins = plugins; myAllPlugins = allPlugins; - setTitle("Choose Plugins to Install"); + setTitle("Choose Plugins to Install or Enable"); init(); } @@ -70,12 +69,18 @@ public class PluginsAdvertiserDialog extends DialogWrapper { @Override protected void doOKAction() { + final Set pluginsToEnable = new HashSet(); final List nodes = new ArrayList(); for (PluginDownloader downloader : myUploadedPlugins) { if (!mySkippedPlugins.contains(downloader.getPluginId())) { - final PluginNode pluginNode = PluginDownloader.createPluginNode(null, downloader); - if (pluginNode != null) { - nodes.add(pluginNode); + final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId(downloader.getPluginId())); + if (descriptor != null) { + pluginsToEnable.add(descriptor); + } else { + final PluginNode pluginNode = PluginDownloader.createPluginNode(null, downloader); + if (pluginNode != null) { + nodes.add(pluginNode); + } } } } @@ -90,6 +95,9 @@ public class PluginsAdvertiserDialog extends DialogWrapper { catch (IOException e) { LOG.error(e); } + for (IdeaPluginDescriptor pluginDescriptor : pluginsToEnable) { + PluginManagerCore.enablePlugin(pluginDescriptor.getPluginId().getIdString()); + } super.doOKAction(); } } From 80d9d5821e97eb939dac9d11b4e9180ec5cdf514 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 22 Oct 2013 15:59:25 +0200 Subject: [PATCH 12/22] plugins advertisement: suggest to restart when only enable is requested --- .../ide/plugins/ActionInstallPlugin.java | 2 +- .../ide/plugins/PluginManagerMain.java | 9 +++++---- ...inAdvertiserEditorNotificationProvider.java | 2 +- .../PluginsAdvertiserDialog.java | 18 ++++++++++++------ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java b/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java index a72187b97ef0..7d01ea2ca91d 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java @@ -153,7 +153,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware { } if (needToRestart) { - PluginManagerMain.notifyPluginsWereInstalled(list.size() == 1 ? list.get(0).getName() : null); + PluginManagerMain.notifyPluginsWereInstalled(list.size() == 1 ? list.get(0).getName() : null, null); } } } diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java index 671ae6fd2ceb..5c80c011c7cc 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java @@ -32,6 +32,7 @@ import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.*; import com.intellij.openapi.project.DumbAwareAction; +import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.updateSettings.impl.PluginDownloader; import com.intellij.openapi.updateSettings.impl.UpdateChecker; @@ -520,13 +521,13 @@ public abstract class PluginManagerMain implements Disposable { } - public static void notifyPluginsWereInstalled(@Nullable String pluginName) { + public static void notifyPluginsWereInstalled(@Nullable String pluginName, final Project project) { notifyPluginsWereUpdated(pluginName != null ? "Plugin \'" + pluginName + "\' was successfully installed" - : "Plugins were installed"); + : "Plugins were installed", project); } - public static void notifyPluginsWereUpdated(final String title) { + public static void notifyPluginsWereUpdated(final String title, final Project project) { final ApplicationEx app = ApplicationManagerEx.getApplicationEx(); final boolean restartCapable = app.isRestartCapable(); String message = @@ -550,7 +551,7 @@ public abstract class PluginManagerMain implements Disposable { app.exit(true); } } - }).notify(null); + }).notify(project); } protected class SortByStatusAction extends ToggleAction { diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java index d2cc3244c620..3e86a83e3ecf 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java @@ -89,7 +89,7 @@ public class PluginAdvertiserEditorNotificationProvider extends EditorNotificati myEnabledExtensions.add(extension); PluginManagerCore.enablePlugin(disabledPlugin.getPluginId().getIdString()); myNotifications.updateAllNotifications(); - PluginManagerMain.notifyPluginsWereUpdated("Plugin was successfully enabled"); + PluginManagerMain.notifyPluginsWereUpdated("Plugin was successfully enabled", myProject); } }); } else { diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java index 8b7d148f2012..b712bf3b9688 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiserDialog.java @@ -38,12 +38,14 @@ import java.util.Set; public class PluginsAdvertiserDialog extends DialogWrapper { private static final Logger LOG = Logger.getInstance("#" + PluginsAdvertiserDialog.class.getName()); + @Nullable private final Project myProject; private final PluginDownloader[] myUploadedPlugins; private final List myAllPlugins; private final HashSet mySkippedPlugins = new HashSet(); PluginsAdvertiserDialog(@Nullable Project project, PluginDownloader[] plugins, List allPlugins) { super(project); + myProject = project; myUploadedPlugins = plugins; myAllPlugins = allPlugins; setTitle("Choose Plugins to Install or Enable"); @@ -84,13 +86,14 @@ public class PluginsAdvertiserDialog extends DialogWrapper { } } } + final Runnable notifyRunnable = new Runnable() { + @Override + public void run() { + PluginManagerMain.notifyPluginsWereInstalled(null, myProject); + } + }; try { - PluginManagerMain.downloadPlugins(nodes, myAllPlugins, new Runnable() { - @Override - public void run() { - PluginManagerMain.notifyPluginsWereInstalled(null); - } - }, null); + PluginManagerMain.downloadPlugins(nodes, myAllPlugins, notifyRunnable, null); } catch (IOException e) { LOG.error(e); @@ -98,6 +101,9 @@ public class PluginsAdvertiserDialog extends DialogWrapper { for (IdeaPluginDescriptor pluginDescriptor : pluginsToEnable) { PluginManagerCore.enablePlugin(pluginDescriptor.getPluginId().getIdString()); } + if (nodes.isEmpty()) { + notifyRunnable.run(); + } super.doOKAction(); } } From 247da91acb564fca2c6049c6e58aa817a7abaa72 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 22 Oct 2013 16:13:29 +0200 Subject: [PATCH 13/22] testdata fixed --- .../moveMembers/multipleWithDependencies1/after/A.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java/java-tests/testData/refactoring/moveMembers/multipleWithDependencies1/after/A.java b/java/java-tests/testData/refactoring/moveMembers/multipleWithDependencies1/after/A.java index f7e8cc3b9037..eb61624120f4 100644 --- a/java/java-tests/testData/refactoring/moveMembers/multipleWithDependencies1/after/A.java +++ b/java/java-tests/testData/refactoring/moveMembers/multipleWithDependencies1/after/A.java @@ -1,2 +1,3 @@ public class A { + } From 53f4af7693a970b372bdb0fe3351709f2198d251 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 16:15:25 +0200 Subject: [PATCH 14/22] proper empty text --- .../com/intellij/ide/actions/SearchEverywhereAction.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 402f23a511a4..796fab9168bf 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -79,6 +79,7 @@ import com.intellij.util.Consumer; import com.intellij.util.IconUtil; import com.intellij.util.indexing.FindSymbolParameters; import com.intellij.util.ui.EmptyIcon; +import com.intellij.util.ui.StatusText; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -806,6 +807,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA @Override public void run() { try { + myList.getEmptyText().setText("Searching..."); //noinspection SSBasedInspection UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override @@ -846,6 +848,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } catch (Exception ignore) { } + finally { + myList.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); + } } private void buildToolWindows(String pattern) { @@ -1470,7 +1475,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA titleLabel.setForeground(UIUtil.getLabelDisabledForeground()); final Color bg = UIUtil.getListBackground(); SeparatorComponent separatorComponent = - new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._240, Gray._80), null); + new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._220, Gray._80), null); JPanel result = new JPanel(new BorderLayout(5, 10)); result.add(titleLabel, BorderLayout.WEST); From 4dc762dfbfdd1e05797479a77601fa36346cebf1 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 16:15:51 +0200 Subject: [PATCH 15/22] label disabled foreground --- .../src/com/intellij/ide/ui/laf/intellijlaf.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties index 04fa6e278cde..f0c8bc9378fb 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties @@ -30,6 +30,8 @@ control=cccccc link.foreground=589df6 ScrollBarUI=com.intellij.ide.ui.laf.darcula.ui.DarculaScrollBarUI +Label.disabledForeground=777777 + TableHeaderUI=com.intellij.ide.ui.laf.darcula.DarculaTableHeaderUI Table.gridColor=2c2c2c Table.ascendingSortIcon=AllIcons.General.SplitUp From 8d72ccd0aa400ddd00f647bb0bc980cd3b6a7802 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Tue, 22 Oct 2013 18:51:28 +0400 Subject: [PATCH 16/22] 'thread dump' is replaced with 'stacktrace' to be more clearer for single-threaded environments --- .../src/com/intellij/unscramble/AnalyzeStacktraceDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceDialog.java b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceDialog.java index 37a975969aef..4eefc7c36d39 100644 --- a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceDialog.java +++ b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceDialog.java @@ -40,7 +40,7 @@ public class AnalyzeStacktraceDialog extends DialogWrapper { @Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); - panel.add(new JLabel("Put a thread dump here:"), BorderLayout.NORTH); + panel.add(new JLabel("Put a stacktrace here:"), BorderLayout.NORTH); myEditorPanel = AnalyzeStacktraceUtil.createEditorPanel(myProject, myDisposable); myEditorPanel.pasteTextFromClipboard(); panel.add(myEditorPanel, BorderLayout.CENTER); From 81f1503ac3afd96f8005aa196a4ab3d79f36790d Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 16:55:18 +0200 Subject: [PATCH 17/22] reduce delay between pressed shifts --- .../src/com/intellij/ide/actions/SearchEverywhereAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 796fab9168bf..db83ec4f9481 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -147,7 +147,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA return false; } ourOtherKeyWasPressed.set(false); - if (System.currentTimeMillis() - ourLastTimePressed.get() > 400) { + if (System.currentTimeMillis() - ourLastTimePressed.get() > 300) { ourPressed.set(false); ourReleased.set(false); } From 796ec6e53c337f929331bbaea095dd00284f0a22 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 22 Oct 2013 12:43:00 +0200 Subject: [PATCH 18/22] do not log ProcessCanceledException --- .../src/com/intellij/util/concurrency/QueueProcessor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java b/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java index 4b52037463a1..34238e57c635 100644 --- a/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java +++ b/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java @@ -19,6 +19,7 @@ import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Conditions; import com.intellij.util.Consumer; @@ -236,6 +237,9 @@ public class QueueProcessor { try { run.run(); } + catch (ProcessCanceledException e) { + throw e; + } catch (Throwable e) { try { LOG.error(e); From 6e76b396966a03bf87cd59f6829cdc638435e0f1 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 22 Oct 2013 16:54:09 +0200 Subject: [PATCH 19/22] jzlib was missing from required_for_dist --- lib/required_for_dist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt index 4748fbdd671c..111f8821205a 100644 --- a/lib/required_for_dist.txt +++ b/lib/required_for_dist.txt @@ -27,6 +27,7 @@ jsr166e.jar jsr173_1.0_api.jar junit-4.10.jar junit.jar +jzlib-1.1.1.jar log4j.jar markdownj-core-0.4.2-SNAPSHOT.jar microba.jar From aee2167566c710e58ae3a314801ac1e7f4be0a57 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Tue, 22 Oct 2013 13:21:20 +0200 Subject: [PATCH 20/22] recover from PersistentHashMap storage format change --- .../api/indexer/CompilerOutputBaseIndex.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputBaseIndex.java b/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputBaseIndex.java index 8e03e4b18c84..f8cdc56ad79a 100644 --- a/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputBaseIndex.java +++ b/java/java-impl/src/com/intellij/compilerOutputIndex/api/indexer/CompilerOutputBaseIndex.java @@ -9,6 +9,7 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.indexing.*; import com.intellij.util.io.DataExternalizer; +import com.intellij.util.io.IOUtil; import com.intellij.util.io.KeyDescriptor; import com.intellij.util.io.PersistentHashMap; import org.jetbrains.asm4.ClassReader; @@ -49,15 +50,26 @@ public abstract class CompilerOutputBaseIndex { rewriteIndex.set(true); } final File storageFile = getStorageFile(indexId); - final MapIndexStorage indexStorage = new MapIndexStorage(storageFile, myKeyDescriptor, myValueExternalizer, 1024); + MapIndexStorage indexStorage = null; + for(int i = 0; i < 2; ++i) { + try { + indexStorage = new MapIndexStorage(storageFile, myKeyDescriptor, myValueExternalizer, 1024); + } catch (IOException ex) { + if (i == 1) throw ex; + IOUtil.deleteAllFilesStartingWith(storageFile); + } + } + + assert indexStorage != null; index = new MapReduceIndex(indexId, getIndexer(), indexStorage); + final MapIndexStorage finalIndexStorage = indexStorage; index.setInputIdToDataKeysIndex(new Factory>>() { @Override public PersistentHashMap> create() { Exception failCause = null; for (int attempts = 0; attempts < 2; attempts++) { try { - return FileBasedIndexImpl.createIdToDataKeysIndex(indexId, myKeyDescriptor, new MemoryIndexStorage(indexStorage)); + return FileBasedIndexImpl.createIdToDataKeysIndex(indexId, myKeyDescriptor, new MemoryIndexStorage(finalIndexStorage)); } catch (IOException e) { failCause = e; From 33d50cb17d7f827f5168ba1eb37b6d75bfcc40e5 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 22 Oct 2013 17:29:40 +0200 Subject: [PATCH 21/22] +goto symbol --- .../ide/actions/SearchEverywhereAction.java | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index db83ec4f9481..223f973cb2d6 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -107,9 +107,11 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA private GotoClassModel2 myClassModel; private GotoFileModel myFileModel; private GotoActionModel myActionModel; + private GotoSymbolModel2 mySymbolsModel; private String[] myClasses; private String[] myFiles; private String[] myActions; + private String[] mySymbols; private Component myFocusComponent; private JBPopup myPopup; private SearchListModel myListModel = new SearchListModel(); @@ -845,6 +847,12 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA buildActionsAndSettings(pattern); updatePopup(); + + readLock = ApplicationManager.getApplication().acquireReadActionLock(); + try { + buildSymbols(pattern); + } finally {readLock.finish();} + updatePopup(); } catch (Exception ignore) { } @@ -854,6 +862,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } private void buildToolWindows(String pattern) { + if (myActions == null) { + myActions = myActionModel.getNames(true); + } final HashSet toolWindows = new HashSet(); final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE); List matches = collectResults(pattern, myActions, myActionModel); @@ -888,6 +899,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA final Set actions = new HashSet(); final Set settings = new HashSet(); final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE); + if (myActions == null) { + myActions = myActionModel.getNames(true); + } List matches = collectResults(pattern, myActions, myActionModel); @@ -933,6 +947,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA private void buildFiles(String pattern) { int filesCounter = 0; + if (myFiles == null) { + myFiles = myFileModel.getNames(false); + } List matches = collectResults(pattern, myFiles, myFileModel); final List files = new ArrayList(); FindSymbolParameters parameters = FindSymbolParameters.wrap(pattern, project, false); @@ -976,9 +993,52 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } } + private void buildSymbols(String pattern) { + int symbolCounter = 0; + if (mySymbols == null) { + mySymbols = mySymbolsModel.getNames(false); + } + List matches = collectResults(pattern, mySymbols, mySymbolsModel); + final List symbols = new ArrayList(); + + final int maxFiles = 8; + for (MatchResult o : matches) { + if (symbolCounter > maxFiles) break; + + Object[] objects = mySymbolsModel.getElementsByName(o.elementName, false, pattern); + for (Object object : objects) { + if (!myListModel.contains(object)) { + symbols.add(object); + symbolCounter++; + if (symbolCounter > maxFiles) break; + } + } + } + + myProgressIndicator.checkCanceled(); + + if (symbols.size() > 0) { + UIUtil.invokeAndWaitIfNeeded(new Runnable() { + @Override + public void run() { + if (!myProgressIndicator.isCanceled()) { + myTitleIndexes.symbols = myListModel.size(); + for (Object file : symbols) { + myListModel.addElement(file); + } + myMoreFilesIndex = symbols.size() >= maxFiles ? myListModel.size() - 1 : -1; + } + } + }); + } + } + private void buildClasses(String pattern, boolean includeLibraries) { int clsCounter = 0; final int maxCount = includeLibraries ? 5 : 8; + if (myClasses == null) { + myClasses = myClassModel.getNames(false); + } List matches = collectResults(pattern, includeLibraries ? myClassModel.getNames(true) : myClasses, myClassModel); FindSymbolParameters parameters = FindSymbolParameters.wrap(pattern, project, includeLibraries); final List classes = new ArrayList(); @@ -1094,9 +1154,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA myClassModel = new GotoClassModel2(project); myFileModel = new GotoFileModel(project); myActionModel = createActionModel(); - myClasses = myClassModel.getNames(false); - myFiles = myFileModel.getNames(false); - myActions = myActionModel.getNames(true); + mySymbolsModel = new GotoSymbolModel2(project); myConfigurables.clear(); fillConfigurablesIds(null, new IdeConfigurablesGroup().getConfigurables()); fillConfigurablesIds(null, new ProjectConfigurablesGroup(project).getConfigurables()); @@ -1383,12 +1441,14 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA int actions; int settings; int toolWindows; + int symbols; final String gotoClassTitle; final String gotoFileTitle; final String gotoActionTitle; final String gotoSettingsTitle; final String gotoRecentFilesTitle; + final String gotoSymbolTitle; static final String toolWindowsTitle = "Tool Windows"; TitleIndexes() { @@ -1402,6 +1462,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA gotoSettingsTitle = StringUtil.isEmpty(gotoAction) ? "Preferences" : "Preferences (" + gotoSettings + ")"; String gotoRecentFiles = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction("RecentFiles")); gotoRecentFilesTitle = StringUtil.isEmpty(gotoRecentFiles) ? "Recent Files" : "Recent Files (" + gotoRecentFiles + ")"; + String gotoSymbol = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction("GotoSymbol")); + gotoSymbolTitle = StringUtil.isEmpty(gotoClass) ? "Symbols" : "Symbols (" + gotoSymbol + ")"; } String getTitle(int index) { @@ -1412,6 +1474,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA if (index == toolWindows) return toolWindowsTitle; if (index == actions) return gotoActionTitle; if (index == settings) return gotoSettingsTitle; + if (index == symbols) return gotoSymbolTitle; return null; } From c8770e0e7c9fa4df54c7eaf4f0a51b1338e8577e Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 22 Oct 2013 20:05:02 +0400 Subject: [PATCH 22/22] fix extract method. revert engine changes. --- .../psi/impl/search/MethodTextOccurrenceProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodTextOccurrenceProcessor.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodTextOccurrenceProcessor.java index e07525d2e107..0759c1643216 100644 --- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodTextOccurrenceProcessor.java +++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodTextOccurrenceProcessor.java @@ -64,7 +64,9 @@ public class MethodTextOccurrenceProcessor extends RequestResultProcessor { return consumer.process(ref); } - return processInexactReference(ref, ref.resolve(), method, consumer); + if (!processInexactReference(ref, ref.resolve(), method, consumer)) { + return false; + } } return true;