From 9a05fcba21501650a1b9a62454769473b4b37c01 Mon Sep 17 00:00:00 2001 From: "liana.bakradze" Date: Sun, 11 Oct 2015 23:35:29 +0300 Subject: [PATCH 01/10] initial version of app engine console --- python/helpers/pycharm/appcfg_fetcher.py | 62 +++++++++++++++++++ .../com/jetbrains/python/PythonHelper.java | 2 + 2 files changed, 64 insertions(+) create mode 100644 python/helpers/pycharm/appcfg_fetcher.py diff --git a/python/helpers/pycharm/appcfg_fetcher.py b/python/helpers/pycharm/appcfg_fetcher.py new file mode 100644 index 000000000000..db759b520410 --- /dev/null +++ b/python/helpers/pycharm/appcfg_fetcher.py @@ -0,0 +1,62 @@ +import sys +import optparse +from django_manage_commands_provider import _xml + + +class Option: + def __init__(self): + self.long = [] + self.short = [] + self.arg = None + self.help = None + + def dump(self, dumper): + dumper.add_command_option(self.long, self.short, self.help, self.arg) + + +def parse_option_desc(option_desc): + option = Option() + option.short = option_desc._short_opts + option.long = option_desc._long_opts + option.help = option_desc.help + if option_desc.nargs > 0: + option.arg = (option_desc.nargs, option_desc.type) + return option + + +def get_options(options_parser): + return map(parse_option_desc, options_parser.option_list) + + +def dump_actions(dumper, app): + common_options = get_options(app._GetOptionParser()) + + for name, action in app.actions.iteritems(): + dumper.start_command(name, action.short_desc) + + args = action.usage.split(name.split(' ')[0])[-1].strip() + dumper.set_arguments(args) + + for option in common_options: + option.dump(dumper) + + if action.options: + parser = optparse.OptionParser(conflict_handler='resolve') + action.options(app, parser) + for option in get_options(parser): + option.dump(dumper) + dumper.close_command() + + +if __name__ == "__main__": + sys.path.append(sys.argv[1]) + import appcfg + + try: + appcfg.run_file('appcfg.py', globals()) + finally: + app = AppCfgApp(['appcfg.py', 'help']) + dumper = _xml.XmlDumper() + dump_actions(dumper, app) + print(dumper.xml) + sys.exit(0) diff --git a/python/src/com/jetbrains/python/PythonHelper.java b/python/src/com/jetbrains/python/PythonHelper.java index e5f57b052926..a9766ddacc6d 100644 --- a/python/src/com/jetbrains/python/PythonHelper.java +++ b/python/src/com/jetbrains/python/PythonHelper.java @@ -58,6 +58,8 @@ public enum PythonHelper implements HelperPackage { DJANGO_MANAGE("pycharm", "django_manage"), MANAGE_TASKS_PROVIDER("pycharm", "_jb_manage_tasks_provider"), + APPCFG_CONSOLE("pycharm", "appcfg_fetcher"), + BUILDOUT_ENGULFER("pycharm", "buildout_engulfer"), EPYDOC_FORMATTER("epydoc_formatter.py"), From dbbbd344204331d62494418cfd39e38ee42c5880 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 13 Oct 2015 12:14:11 +0300 Subject: [PATCH 02/10] don't move caret while in bulk mode --- .../intellij/formatting/FormatProcessor.java | 78 ++++++++++--------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java index cc076c5d1708..d8cdaebbdc6d 100644 --- a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java +++ b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java @@ -345,17 +345,15 @@ public class FormatProcessor { } /** - * Decides whether applying formatter changes should be applied incrementally one-by-one or merge result should be - * constructed locally and the whole document text should be replaced. Performs such single bulk change if necessary. + * Performs formatter changes in a series of blocks, for each block a new contents of document is calculated + * and whole document is replaced in one operation. * * @param blocksToModify changes introduced by formatter * @param model current formatting model * @param indentOption indent options to use - * @return true if given changes are applied to the document (i.e. no further processing is required); - * false otherwise */ @SuppressWarnings({"deprecation"}) - private boolean applyChangesAtRewriteMode(@NotNull final List blocksToModify, + private void applyChangesAtRewriteMode(@NotNull final List blocksToModify, @NotNull final FormattingModel model, @NotNull CommonCodeStyleSettings.IndentOptions indentOption) { @@ -363,33 +361,39 @@ public class FormatProcessor { Document document = documentModel.getDocument(); CaretOffsetUpdater caretOffsetUpdater = new CaretOffsetUpdater(document); - List changes = new ArrayList(); - int shift = 0; - int currentIterationShift = 0; - for (LeafBlockWrapper block : blocksToModify) { - WhiteSpace whiteSpace = block.getWhiteSpace(); - CharSequence newWs = documentModel.adjustWhiteSpaceIfNecessary( - whiteSpace.generateWhiteSpace(getIndentOptionsToUse(block, indentOption)), whiteSpace.getStartOffset(), - whiteSpace.getEndOffset(), block.getNode(), false - ); - if (changes.size() > 10000) { - caretOffsetUpdater.update(changes); - CharSequence mergeResult = BulkChangesMerger.INSTANCE.mergeToCharSequence(document.getChars(), document.getTextLength(), changes); - document.replaceString(0, document.getTextLength(), mergeResult); - shift += currentIterationShift; - currentIterationShift = 0; - changes.clear(); + if (document instanceof DocumentEx) ((DocumentEx)document).setInBulkUpdate(true); + try { + List changes = new ArrayList(); + int shift = 0; + int currentIterationShift = 0; + for (LeafBlockWrapper block : blocksToModify) { + WhiteSpace whiteSpace = block.getWhiteSpace(); + CharSequence newWs = documentModel.adjustWhiteSpaceIfNecessary( + whiteSpace.generateWhiteSpace(getIndentOptionsToUse(block, indentOption)), whiteSpace.getStartOffset(), + whiteSpace.getEndOffset(), block.getNode(), false + ); + if (changes.size() > 10000) { + caretOffsetUpdater.update(changes); + CharSequence mergeResult = BulkChangesMerger.INSTANCE.mergeToCharSequence(document.getChars(), document.getTextLength(), changes); + document.replaceString(0, document.getTextLength(), mergeResult); + shift += currentIterationShift; + currentIterationShift = 0; + changes.clear(); + } + TextChangeImpl change = new TextChangeImpl(newWs, whiteSpace.getStartOffset() + shift, whiteSpace.getEndOffset() + shift); + currentIterationShift += change.getDiff(); + changes.add(change); } - TextChangeImpl change = new TextChangeImpl(newWs, whiteSpace.getStartOffset() + shift, whiteSpace.getEndOffset() + shift); - currentIterationShift += change.getDiff(); - changes.add(change); + caretOffsetUpdater.update(changes); + CharSequence mergeResult = BulkChangesMerger.INSTANCE.mergeToCharSequence(document.getChars(), document.getTextLength(), changes); + document.replaceString(0, document.getTextLength(), mergeResult); } - caretOffsetUpdater.update(changes); - CharSequence mergeResult = BulkChangesMerger.INSTANCE.mergeToCharSequence(document.getChars(), document.getTextLength(), changes); - document.replaceString(0, document.getTextLength(), mergeResult); + finally { + if (document instanceof DocumentEx) ((DocumentEx)document).setInBulkUpdate(false); + } + caretOffsetUpdater.restoreCaretLocations(); cleanupBlocks(blocksToModify); - return true; } private static void cleanupBlocks(List blocks) { @@ -1472,17 +1476,17 @@ public class FormatProcessor { myProgressCallback.beforeApplyingFormatChanges(myBlocksToModify); final int blocksToModifyCount = myBlocksToModify.size(); - final boolean bulkReformat = blocksToModifyCount > 50; - DocumentEx updatedDocument = bulkReformat ? getAffectedDocument(myModel) : null; - if (updatedDocument != null) { - updatedDocument.setInBulkUpdate(true); - myResetBulkUpdateState = true; - } - if (blocksToModifyCount > BULK_REPLACE_OPTIMIZATION_CRITERIA - && applyChangesAtRewriteMode(myBlocksToModify, myModel, myDefaultIndentOption)) - { + if (blocksToModifyCount > BULK_REPLACE_OPTIMIZATION_CRITERIA) { + applyChangesAtRewriteMode(myBlocksToModify, myModel, myDefaultIndentOption); setDone(true); } + else if (blocksToModifyCount > 50) { + DocumentEx updatedDocument = getAffectedDocument(myModel); + if (updatedDocument != null) { + updatedDocument.setInBulkUpdate(true); + myResetBulkUpdateState = true; + } + } } @Override From 3d8db74df490e49397ec8bf82e1d29d73a773309 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 13 Oct 2015 12:59:52 +0300 Subject: [PATCH 03/10] editor new rendering: avoid unnecessary iteration over lexer tokens --- .../openapi/editor/impl/view/LineLayout.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java index 72554793b234..119d4c9c49c6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java @@ -84,17 +84,11 @@ class LineLayout { private static List createFragments(@NotNull EditorView view, int lineStartOffset, int lineEndOffset, boolean skipBidiLayout) { if (lineEndOffset <= lineStartOffset) return Collections.emptyList(); + if (skipBidiLayout) return Collections.singletonList(new BidiRun(lineEndOffset - lineStartOffset)); EditorImpl editor = view.getEditor(); - List runs; - if (skipBidiLayout) { - runs = Collections.singletonList(new BidiRun((byte)0, 0, lineEndOffset - lineStartOffset)); - } - else { - CharSequence text = editor.getDocument().getImmutableCharSequence().subSequence(lineStartOffset, lineEndOffset); - char[] chars = CharArrayUtil.fromSequence(text); - runs = createRuns(editor, chars, lineStartOffset); - } - return runs; + CharSequence text = editor.getDocument().getImmutableCharSequence().subSequence(lineStartOffset, lineEndOffset); + char[] chars = CharArrayUtil.fromSequence(text); + return createRuns(editor, chars, lineStartOffset); } private static List createFragments(@NotNull EditorView view, @NotNull CharSequence text, @@ -115,7 +109,9 @@ class LineLayout { private static List createRuns(EditorImpl editor, char[] text, int startOffsetInEditor) { int textLength = text.length; - if (editor.myDisableRtl) return Collections.singletonList(new BidiRun((byte)0, 0, textLength)); + if (editor.myDisableRtl || !Bidi.requiresBidi(text, 0, textLength)) { + return Collections.singletonList(new BidiRun(textLength)); + } List runs = new ArrayList(); if (startOffsetInEditor >= 0) { // running bidi algorithm separately for text fragments corresponding to different lexer tokens @@ -324,6 +320,10 @@ class LineLayout { private final int endOffset; private Chunk[] chunks; // in logical order + private BidiRun(int length) { + this((byte)0, 0, length); + } + private BidiRun(byte level, int startOffset, int endOffset) { this.level = level; this.startOffset = startOffset; From 3cfa41ca5b06110ce447d07f51cb9778e01aaa87 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 13 Oct 2015 13:54:26 +0300 Subject: [PATCH 04/10] use Java 8 features in test case --- ...apApplianceOnDocumentModificationTest.java | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java index 6c6750b21575..9f669b0a81ef 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java @@ -27,7 +27,6 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.TestFileType; import gnu.trove.TIntHashSet; -import gnu.trove.TIntProcedure; import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -56,12 +55,16 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT @Override protected void tearDown() throws Exception { - if (myEditor != null) { - EditorSettings settings = myEditor.getSettings(); - settings.setUseSoftWraps(false); - settings.setSmartHome(mySmartHome); + try { + if (myEditor != null) { + EditorSettings settings = myEditor.getSettings(); + settings.setUseSoftWraps(false); + settings.setSmartHome(mySmartHome); + } + } + finally { + super.tearDown(); } - super.tearDown(); } public void testSoftWrapAdditionOnTyping() throws Exception { @@ -236,12 +239,9 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT type('2'); final TIntHashSet offsetsAfter = collectSoftWrapStartOffsets(1); assertSame(offsetsBefore.size(), offsetsAfter.size()); - offsetsBefore.forEach(new TIntProcedure() { - @Override - public boolean execute(int value) { - assertTrue(offsetsAfter.contains(value + 1)); - return true; - } + offsetsBefore.forEach(value -> { + assertTrue(offsetsAfter.contains(value + 1)); + return true; }); } @@ -298,7 +298,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT "This a long string that is expected to be wrapped in more than one visual line"; init(20, text); - List softWrapsBeforeModification = new ArrayList(getSoftWrapModel().getRegisteredSoftWraps()); + List softWrapsBeforeModification = new ArrayList<>(getSoftWrapModel().getRegisteredSoftWraps()); assertTrue(softWrapsBeforeModification.size() > 0); backspace(); @@ -312,7 +312,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT "Long line2 that is expected to be soft-wrapped"; init(20, text); - List softWrapsBeforeModification = new ArrayList(getSoftWrapModel().getRegisteredSoftWraps()); + List softWrapsBeforeModification = new ArrayList<>(getSoftWrapModel().getRegisteredSoftWraps()); assertTrue(softWrapsBeforeModification.size() > 0); int offset = myEditor.getCaretModel().getOffset(); @@ -475,7 +475,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT init(30, text); myEditor.getCaretModel().moveToOffset(text.indexOf("}") - 1); - List softWraps = new ArrayList(getSoftWrapModel().getRegisteredSoftWraps()); + List softWraps = new ArrayList<>(getSoftWrapModel().getRegisteredSoftWraps()); assertTrue(!softWraps.isEmpty()); CaretModel caretModel = myEditor.getCaretModel(); @@ -516,7 +516,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT init(30, text); myEditor.getCaretModel().moveToOffset(text.indexOf("\n") + 1); - List softWraps = new ArrayList(getSoftWrapModel().getRegisteredSoftWraps()); + List softWraps = new ArrayList<>(getSoftWrapModel().getRegisteredSoftWraps()); assertTrue(!softWraps.isEmpty()); CaretModel caretModel = myEditor.getCaretModel(); @@ -620,7 +620,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT myEditor.getSelectionModel().setSelection(startOffset, endOffset); VisualPosition positionBefore = myEditor.offsetToVisualPosition(document.getLineStartOffset(lineToSelect + 1)); - List softWrapsBefore = new ArrayList(getSoftWrapModel().getRegisteredSoftWraps()); + List softWrapsBefore = new ArrayList<>(getSoftWrapModel().getRegisteredSoftWraps()); copy(); paste(); @@ -644,7 +644,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT int end = document.getLineEndOffset(1) + 1; int visualLinesToRemove = getSoftWrapModel().getSoftWrapsForLine(1).size() + 1; - List positionsBefore = new ArrayList(); + List positionsBefore = new ArrayList<>(); for (int i = end; i < text.length(); i++) { positionsBefore.add(myEditor.offsetToVisualPosition(i)); } @@ -727,18 +727,15 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT // Simulate addition of the new import that modifies existing fold region. myEditor.getDocument().insertString(foldEndOffset, "\nimport java.util.Date;\n"); final FoldingModel foldingModel = myEditor.getFoldingModel(); - foldingModel.runBatchFoldingOperation(new Runnable() { - @Override - public void run() { - FoldRegion oldFoldRegion = getFoldRegion(foldStartOffset); - assertNotNull(oldFoldRegion); - foldingModel.removeFoldRegion(oldFoldRegion); - - int newFoldEndOffset = myEditor.getDocument().getText().indexOf("class") - 2; - FoldRegion newFoldRegion = foldingModel.addFoldRegion(foldStartOffset, newFoldEndOffset, "..."); - assertNotNull(newFoldRegion); - newFoldRegion.setExpanded(false); - } + foldingModel.runBatchFoldingOperation(() -> { + FoldRegion oldFoldRegion = getFoldRegion(foldStartOffset); + assertNotNull(oldFoldRegion); + foldingModel.removeFoldRegion(oldFoldRegion); + + int newFoldEndOffset = myEditor.getDocument().getText().indexOf("class") - 2; + FoldRegion newFoldRegion = foldingModel.addFoldRegion(foldStartOffset, newFoldEndOffset, "..."); + assertNotNull(newFoldRegion); + newFoldRegion.setExpanded(false); }); CodeFoldingManager.getInstance(getProject()).updateFoldRegions(myEditor); assertEquals(new VisualPosition(2, 0), myEditor.logicalToVisualPosition(new LogicalPosition(5, 0))); @@ -1005,7 +1002,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT final String text = "12345678 abcdefgh"; init(15, 7, text); myEditor.getCaretModel().moveToOffset(text.length()); - final Ref fail = new Ref(true); + final Ref fail = new Ref<>(true); SoftWrapApplianceManager applianceManager = ((SoftWrapModelImpl)myEditor.getSoftWrapModel()).getApplianceManager(); SoftWrapAwareDocumentParsingListener listener = new SoftWrapAwareDocumentParsingListenerAdapter() { @Override From dec740432477fc4c074c50da698f6728cd6c80b7 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 13 Oct 2015 14:55:06 +0300 Subject: [PATCH 05/10] fix javadoc --- .../src/com/intellij/openapi/editor/LogicalPosition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java index a154351b0175..b16857c0421e 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/LogicalPosition.java @@ -67,7 +67,7 @@ public class LogicalPosition implements Comparable { * Number of virtual soft wrap introduced lines on a current logical line before the visual position that corresponds * to the current logical position. *

- * Instead of directly using this value, EditorUtil.getSoftWrapCountAfterLogicalLineStart(LogicalPosition) method can be used, + * Instead of directly using this value, EditorUtil.getSoftWrapCountAfterLineStart(Editor, LogicalPosition) method can be used, * it will work regardless of whether current LogicalPosition instance is {@link #visualPositionAware}. * * @see #visualPositionAware From bcb3520ffa862b37e8147a7dac6cddb7d67c82b8 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 13 Oct 2015 16:02:46 +0300 Subject: [PATCH 06/10] editor.new.rendering: fix a mistake in TextEndWithSelectionAction --- .../openapi/editor/actions/TextEndWithSelectionAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/TextEndWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/TextEndWithSelectionAction.java index 34420145edae..5d421be8fa2a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/TextEndWithSelectionAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/TextEndWithSelectionAction.java @@ -56,7 +56,7 @@ public class TextEndWithSelectionAction extends TextComponentEditorAction { } int selectionStart = caret.getLeadSelectionOffset(); if (editor instanceof EditorImpl && ((EditorImpl)editor).myUseNewRendering) { - editor.getCaretModel().moveToLogicalPosition(editor.offsetToLogicalPosition(endOffset).leanForward(true)); + caret.moveToLogicalPosition(editor.offsetToLogicalPosition(endOffset).leanForward(true)); } else { caret.moveToOffset(endOffset); From 7d4a8a91651e158041e9603aabf41663292f9929 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 13 Oct 2015 19:07:45 +0200 Subject: [PATCH 07/10] don't run pushers for default project (EA-73923 - ISE: PushedFilePropertiesUpdater.getInstance) --- .../src/com/intellij/lang/PerFileMappingsBase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/projectModel-api/src/com/intellij/lang/PerFileMappingsBase.java b/platform/projectModel-api/src/com/intellij/lang/PerFileMappingsBase.java index d35c4915c55a..ab93381f7fa6 100644 --- a/platform/projectModel-api/src/com/intellij/lang/PerFileMappingsBase.java +++ b/platform/projectModel-api/src/com/intellij/lang/PerFileMappingsBase.java @@ -168,8 +168,9 @@ public abstract class PerFileMappingsBase implements PersistentStateComponent if (oldFile == null) continue; // project oldFile.putUserData(pusher.getFileDataKey(), null); } - PushedFilePropertiesUpdater updater = PushedFilePropertiesUpdater.getInstance(project); - updater.pushAll(pusher); + if (!project.isDefault()) { + PushedFilePropertiesUpdater.getInstance(project).pushAll(pusher); + } } if (shouldReparseFiles()) { Project[] projects = project == null ? ProjectManager.getInstance().getOpenProjects() : new Project[] { project }; From 8166c1990383e9ac5621a87e21619e75a81077cf Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 13 Oct 2015 19:12:17 +0200 Subject: [PATCH 08/10] remove top expression caching from JavaI18nUtil (EA-74472 - SOE: CachedValueBase.getValueWithLock) it seems unnecessary now that we have PsiPolyadicExpression and the tree hierarchy is unlikely to be very deep --- .../codeInspection/i18n/JavaI18nUtil.java | 37 +------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java index 3fd56f225c41..09b76c72ff70 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java @@ -114,49 +114,14 @@ public class JavaI18nUtil extends I18nUtil { return false; } - private static final Key> TOP_LEVEL_EXPRESSION = Key.create("TOP_LEVEL_EXPRESSION"); - @NotNull - static PsiExpression getTopLevelExpression(@NotNull final PsiExpression expression) { - if (expression instanceof PsiBinaryExpression || expression.getParent() instanceof PsiBinaryExpression) { //can be large, cache - CachedValue cachedValue = expression.getUserData(TOP_LEVEL_EXPRESSION); - if (cachedValue == null) { - expression.putUserData(TOP_LEVEL_EXPRESSION, cachedValue = CachedValuesManager.getManager(expression.getProject()).createCachedValue(new CachedValueProvider() { - @Nullable - @Override - public Result compute() { - PsiExpression topLevel = getTopLevel(expression); - CachedValue cachedValue = expression.getUserData(TOP_LEVEL_EXPRESSION); - assert cachedValue != null; - int i = 0; - for (PsiElement element = expression; element != topLevel; element = element.getParent(), i++) { - if (i % 10 == 0) { // optimization: store up link to the top level expression in each 10nth element - element.putUserData(TOP_LEVEL_EXPRESSION, cachedValue); - } - } - return Result.create(topLevel, expression, PsiModificationTracker.MODIFICATION_COUNT); - } - }, false)); - } - return cachedValue.getValue(); - } - return getTopLevel(expression); - } - - @NotNull - private static PsiExpression getTopLevel(@NotNull PsiExpression expression) { + static PsiExpression getTopLevelExpression(@NotNull PsiExpression expression) { while (expression.getParent() instanceof PsiExpression) { final PsiExpression parent = (PsiExpression)expression.getParent(); if (parent instanceof PsiConditionalExpression && ((PsiConditionalExpression)parent).getCondition() == expression) break; expression = parent; if (expression instanceof PsiAssignmentExpression) break; - if (expression instanceof PsiBinaryExpression) { - CachedValue value = expression.getUserData(TOP_LEVEL_EXPRESSION); - if (value != null) { - return value.getValue(); // optimization: use caching for big hierarchies - } - } } return expression; } From 6842714862d0db7d3f6abaea30f8934cd20fce3d Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 13 Oct 2015 19:46:04 +0300 Subject: [PATCH 09/10] Colors: update WarmNeon --- colorSchemes/src/colorSchemes/WarmNeon.xml | 74 +++++++--------------- 1 file changed, 23 insertions(+), 51 deletions(-) diff --git a/colorSchemes/src/colorSchemes/WarmNeon.xml b/colorSchemes/src/colorSchemes/WarmNeon.xml index 55ae9e5db4d5..444eecf7411f 100644 --- a/colorSchemes/src/colorSchemes/WarmNeon.xml +++ b/colorSchemes/src/colorSchemes/WarmNeon.xml @@ -128,6 +128,7 @@ + + + + + - - - - - - - - - +