From 94abe9838232f11064441c203c564ea98122205d Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 18 Feb 2015 12:59:54 +0300 Subject: [PATCH 001/106] link position on retina - better fix --- .../impl/ui/tree/XDebuggerTreeRenderer.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRenderer.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRenderer.java index 2fc1d3f315ed..781bdb7894aa 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRenderer.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRenderer.java @@ -20,7 +20,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.AbstractExpandableItemsHandler; import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.SimpleTextAttributes; -import com.intellij.util.ui.UIUtil; import com.intellij.xdebugger.XDebuggerBundle; import com.intellij.xdebugger.frame.ImmediateFullValueEvaluator; import com.intellij.xdebugger.frame.XDebuggerTreeNodeHyperlink; @@ -48,6 +47,8 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer { public XDebuggerTreeRenderer() { setSupportFontFallback(true); + getIpad().right = 0; + myLink.getIpad().left = 0; } public void customizeCellRenderer(@NotNull final JTree tree, @@ -90,7 +91,6 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer { private void setupLinkDimensions(Rectangle treeVisibleRect, int rowX) { Dimension linkSize = myLink.getPreferredSize(); myLinkWidth = linkSize.width; - myLink.setBounds(0, 0, linkSize.width, linkSize.height); myLinkOffset = Math.min(super.getPreferredSize().width, treeVisibleRect.x + treeVisibleRect.width - myLinkWidth - rowX); } @@ -114,11 +114,10 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer { } finally { textGraphics.dispose(); } - - UIUtil.applyRenderingHints(g); - applyAdditionalHints(g); - - g.drawString(myLink.toString(), myLinkOffset, getTextBaseLine(getFontMetrics(getFont()), getHeight())); + g.translate(myLinkOffset, 0); + myLink.setHeight(getHeight()); + myLink.doPaint(g); + g.translate(-myLinkOffset, 0); } else { super.doPaint(g); @@ -145,6 +144,8 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer { } private static class MyColoredTreeCellRenderer extends ColoredTreeCellRenderer { + private int myHeight; + @Override public void customizeCellRenderer(@NotNull JTree tree, Object value, @@ -158,6 +159,15 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer { protected void doPaint(Graphics2D g) { super.doPaint(g); } + + public void setHeight(int height) { + myHeight = height; + } + + @Override + public int getHeight() { + return myHeight; + } } private static class MyLongTextHyperlink extends XDebuggerTreeNodeHyperlink { From 1c050ca8eb306551153a6284fd9799e6c5900c06 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 18 Feb 2015 11:22:48 +0100 Subject: [PATCH 002/106] IDEA-135891 java.io.IOException: An existing connection was forcibly closed by the remote host --- .../src/org/jetbrains/io/NettyUtil.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java b/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java index c38e372b9c07..1415af6cbcd0 100644 --- a/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java +++ b/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java @@ -26,6 +26,7 @@ import io.netty.channel.oio.OioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.channel.socket.oio.OioSocketChannel; +import io.netty.handler.codec.http.HttpMethod; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponseEncoder; @@ -219,6 +220,22 @@ public final class NettyUtil { if (pipeline.get(ChunkedWriteHandler.class) == null) { pipeline.addLast("chunkedWriteHandler", new ChunkedWriteHandler()); } - pipeline.addLast("corsHandler", new CorsHandler(CorsConfig.withAnyOrigin().allowCredentials().allowNullOrigin().allowedRequestMethods().build())); + pipeline.addLast("corsHandler", new CorsHandlerDoNotUseOwnLogger(CorsConfig + .withAnyOrigin() + .allowCredentials() + .allowNullOrigin() + .allowedRequestMethods(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE, HttpMethod.HEAD, HttpMethod.PATCH) + .build())); + } + + private static final class CorsHandlerDoNotUseOwnLogger extends CorsHandler { + public CorsHandlerDoNotUseOwnLogger(@NotNull CorsConfig config) { + super(config); + } + + @Override + public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception { + context.fireExceptionCaught(cause); + } } } \ No newline at end of file From 49fb95781707447ce22396b67a749086c83ecd6a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 18 Feb 2015 11:27:01 +0100 Subject: [PATCH 003/106] v8 debugger: ability to allow lazy compilation --- platform/util/resources/misc/registry.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 23ed9505bc0a..29e1efcd9fac 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -474,6 +474,7 @@ spy.js.realtime.evaluation.description=Enables spy-js autocomplete and realtime js.debugger.step.over.skip.same.line=true js.debugger.trace.resume=false +js.debugger.v8.lazy.compilation=false new.css.schema.enabled=true html.prefer.short.notation.of.boolean.attributes=true From 17a7b572c8ce75954ff3c951625a4b83c6374b55 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Wed, 18 Feb 2015 13:15:49 +0300 Subject: [PATCH 004/106] Test fix --- .../intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java | 2 +- .../com/intellij/psi/codeStyle/CommonCodeStyleSettings.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java index bb4ff521ebfd..6781dcfef1bf 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java @@ -195,7 +195,7 @@ public interface CodeStyleSettingsCustomizable { SPECIAL_ELSE_IF_TREATMENT, ENUM_CONSTANTS_WRAP, ALIGN_CONSECUTIVE_VARIABLE_DECLARATIONS, - INDENT_BRAKE_FROM_CASE + INDENT_BREAK_FROM_CASE } diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java index 74f1a5c43608..1e7bc6a1c237 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java @@ -43,6 +43,10 @@ import java.util.Set; * @author Rustam Vishnyakov */ public class CommonCodeStyleSettings { + // Dev. notes: + // - Do not add language-specific options here, use CustomCodeStyleSettings instead. + // - A new options should be added to CodeStyleSettingsCustomizable as well. + // - Covered by CodeStyleConfigurationsTest. @NonNls private static final String ARRANGEMENT_ELEMENT_NAME = "arrangement"; From 3d068693ba47f69e1d649bdabc7375193506e170 Mon Sep 17 00:00:00 2001 From: Sergey Savenko Date: Wed, 18 Feb 2015 11:28:13 +0300 Subject: [PATCH 005/106] ComponentWithBrowseButton: do not enable DoClickAction when browse button is disabled or invisible --- .../com/intellij/openapi/ui/ComponentWithBrowseButton.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java index 5ee7a73b73a6..cf0386066bef 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java @@ -173,6 +173,11 @@ public class ComponentWithBrowseButton extends JPanel i myBrowseButton = browseButton; } + @Override + public void update(AnActionEvent e) { + e.getPresentation().setEnabled(myBrowseButton.isVisible() && myBrowseButton.isEnabled()); + } + @Override public void actionPerformed(AnActionEvent e){ myBrowseButton.doClick(); From ef86b79e01164aa1382d12443ebbbecf964afced Mon Sep 17 00:00:00 2001 From: Sergey Savenko Date: Wed, 18 Feb 2015 13:06:52 +0300 Subject: [PATCH 006/106] TRP: use EditValueAction to start editing on --- .../testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java index 7a2b52530d58..a652cea576c9 100644 --- a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java +++ b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java @@ -70,7 +70,7 @@ public abstract class KeymapsTestCase extends PlatformTestCase { { "ADD", "ExpandTreeNode", "Graph.ZoomIn"}, { "BACK_SPACE", "EditorBackSpace", "Images.Thumbnails.UpFolder"}, { "ENTER", "EditorChooseLookupItem", "NextTemplateVariable", "EditorEnter", "Images.Thumbnails.EnterAction", - "PropertyInspectorActions.EditValue", "Console.Execute"}, + "PropertyInspectorActions.EditValue", "Console.Execute", "Console.TableResult.EditValue"}, { "F2", "GotoNextError", "GuiDesigner.EditComponent", "GuiDesigner.EditGroup", "Console.TableResult.EditValue"}, { "alt ENTER", "ShowIntentionActions", "Console.TableResult.EditValue", "DatabaseView.PropertiesAction"}, { "F5", "UML.ApplyCurrentLayout", "CopyElement"}, From cad4dc09d4c802bb687c15f7ca7261dd000867e3 Mon Sep 17 00:00:00 2001 From: Sergey Savenko Date: Wed, 18 Feb 2015 13:57:58 +0300 Subject: [PATCH 007/106] IDEA-88363: TRP: add EditValueInMaximizedCellEditorAction --- .../testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java index a652cea576c9..8be71dea100b 100644 --- a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java +++ b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java @@ -110,6 +110,7 @@ public abstract class KeymapsTestCase extends PlatformTestCase { { "control MINUS", "CollapseAll", "CollapseRegion"}, { "control PERIOD", "EditorChooseLookupItemDot", "CollapseSelection"}, { "shift DELETE", "$Cut", "Maven.Uml.Exclude"}, + { "shift ENTER", "EditorStartNewLine", "Console.TableResult.EditValueMaximized"}, { "shift F4", "Debugger.EditTypeSource", "EditSourceInNewWindow"}, { "shift F7", "PreviousDiff", "SmartStepInto"}, { "shift TAB", "PreviousTemplateVariable", "PrevParameter", "EditorUnindentSelection", "PrevTemplateParameter"}, From fbe46504ba053787a66e28cb32b04cb815873875 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 18 Feb 2015 14:03:08 +0300 Subject: [PATCH 008/106] IDEA-136319 Hungry Backspace intermittent strange behavior --- .../editor/actions/HungryBackspaceAction.java | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/HungryBackspaceAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/HungryBackspaceAction.java index fa69913ea152..19eb5df4d221 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/HungryBackspaceAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/HungryBackspaceAction.java @@ -17,6 +17,7 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; @@ -46,42 +47,24 @@ public class HungryBackspaceAction extends TextComponentEditorAction { } @Override - public void executeWriteAction(@NotNull Editor editor, DataContext dataContext) { + public void executeWriteAction(@NotNull Editor editor, Caret caret, DataContext dataContext) { final Document document = editor.getDocument(); - final int prevSymbolOffset = editor.getCaretModel().getOffset() - 1; - if (prevSymbolOffset < 0) { + final int caretOffset = editor.getCaretModel().getOffset(); + if (caretOffset < 1) { return; } - + final SelectionModel selectionModel = editor.getSelectionModel(); final CharSequence text = document.getCharsSequence(); - final char c = text.charAt(prevSymbolOffset); - final boolean doHungryCheck = !selectionModel.hasSelection() && StringUtil.isWhiteSpace(c); - final EditorActionHandler handler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_BACKSPACE); - handler.execute(editor, dataContext); - - if (!doHungryCheck) { - return; - } - - final int endOffset = prevSymbolOffset; - if (endOffset > document.getTextLength()) { - return; - } - int startOffset = CharArrayUtil.shiftBackward(text, endOffset - 1, "\t \n"); - if (startOffset < 0) { - // No non-white space symbol before the current caret offset has been found. - startOffset = 0; + final char c = text.charAt(caretOffset - 1); + if (!selectionModel.hasSelection() && StringUtil.isWhiteSpace(c)) { + int startOffset = CharArrayUtil.shiftBackward(text, caretOffset - 2, "\t \n") + 1; + document.deleteString(startOffset, caretOffset); } else { - // Offset now points to the first non-white space symbol before the caret. - // Increment it to point to the first white space symbol instead. - startOffset++; + final EditorActionHandler handler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_BACKSPACE); + handler.execute(editor, caret, dataContext); } - if (startOffset >= endOffset) { - return; - } - document.deleteString(startOffset, endOffset); } } } From 5b68f0b6af7a854c327534227a685708f4beffe5 Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Wed, 18 Feb 2015 14:03:41 +0300 Subject: [PATCH 009/106] 14px --- .../openapi/editor/impl/EditorMarkupModelImpl.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java index 6ed9145ad53c..ef13e9d3cc07 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java @@ -84,11 +84,11 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark private static final TooltipGroup ERROR_STRIPE_TOOLTIP_GROUP = new TooltipGroup("ERROR_STRIPE_TOOLTIP_GROUP", 0); private static int getErrorIconWidth() { - return JBUI.scale(13); + return JBUI.scale(14); } private static int getErrorIconHeight() { - return JBUI.scale(13); + return JBUI.scale(14); } private static int getThinGap() { @@ -482,9 +482,6 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark return myEditor.isMirrored(); } - private static final Dimension STRIPE_BUTTON_PREFERRED_SIZE = new Dimension(getErrorIconWidth() + getThinGap(), getErrorIconHeight() + - getThinGap()); - private class ErrorStripeButton extends JButton { private ErrorStripeButton() { setFocusable(false); @@ -513,7 +510,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark g2d.setTransform(old); } else { - int x = getThinGap() + myMinMarkHeight - JBUI.scale(1); + int x = getThinGap() + myMinMarkHeight; final Rectangle b = new Rectangle(x, 0, getErrorIconWidth(), getErrorIconHeight()); myErrorStripeRenderer.paint(this, g, b); } From 6ca2c7ce160d2ca44ea2d2bcc05731f4c0e7e99e Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 18 Feb 2015 12:07:19 +0100 Subject: [PATCH 010/106] IDEA-136675 (Field may be static false positive if initialization expression of a final field has non static method call) --- .../FieldMayBeStaticInspection.java | 14 ++++--- .../FieldMayBeStaticInspection.java | 11 ----- .../field_may_be_static/FieldMayBeStatic.java | 30 ++++++++++++++ .../FieldMayBeStaticInspectionTest.java | 41 +++++++++++++++++++ 4 files changed, 79 insertions(+), 17 deletions(-) delete mode 100644 plugins/InspectionGadgets/test/com/siyeh/igtest/performance/FieldMayBeStaticInspection.java create mode 100644 plugins/InspectionGadgets/test/com/siyeh/igtest/performance/field_may_be_static/FieldMayBeStatic.java create mode 100644 plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/FieldMayBeStaticInspectionTest.java diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/FieldMayBeStaticInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/FieldMayBeStaticInspection.java index 65a352df62e1..c3a3bacc2596 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/FieldMayBeStaticInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/FieldMayBeStaticInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2015 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,9 +69,6 @@ public class FieldMayBeStaticInspection extends BaseInspection { if (SideEffectChecker.mayHaveSideEffects(initializer)) { return; } - if (!canBeStatic(initializer)) { - return; - } final PsiType type = field.getType(); if (!ClassUtils.isImmutable(type)) { return; @@ -84,12 +81,17 @@ public class FieldMayBeStaticInspection extends BaseInspection { // inner class cannot have static declarations return; } + if (containingClass instanceof PsiAnonymousClass) { + return; + } + if (!canBeStatic(initializer)) { + return; + } registerFieldError(field); } private static boolean canBeStatic(PsiExpression initializer) { - final CanBeStaticVisitor canBeStaticVisitor = - new CanBeStaticVisitor(); + final CanBeStaticVisitor canBeStaticVisitor = new CanBeStaticVisitor(); initializer.accept(canBeStaticVisitor); return canBeStaticVisitor.canBeStatic(); } diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/FieldMayBeStaticInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/FieldMayBeStaticInspection.java deleted file mode 100644 index e2048943b578..000000000000 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/FieldMayBeStaticInspection.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.siyeh.igtest.performance; - -public class FieldMayBeStaticInspection -{ - private final int m_fooBar = 3; - private final int m_fooBaz = m_fooBar; - - { - System.out.println("m_fooBaz = " + m_fooBaz); - } -} \ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/field_may_be_static/FieldMayBeStatic.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/field_may_be_static/FieldMayBeStatic.java new file mode 100644 index 000000000000..f354cb0769d1 --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/field_may_be_static/FieldMayBeStatic.java @@ -0,0 +1,30 @@ +package com.siyeh.igtest.performance.field_may_be_static; + +public class FieldMayBeStatic +{ + private final int m_fooBar = 3; + private final int m_fooBaz = m_fooBar; + + { + System.out.println("m_fooBaz = " + m_fooBaz); + } + + private static class Namer { + private String name = "name"; + + public String getString() { + return name; + } + + public void run() { + + new Namer() { + final String usage = "Usage: " + getString(); + public void action() { + + System.out.println(usage); + } + }; + } + } +} \ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/FieldMayBeStaticInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/FieldMayBeStaticInspectionTest.java new file mode 100644 index 000000000000..9062c9044aae --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/performance/FieldMayBeStaticInspectionTest.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * (c) 2015 Silent Forest AB + * created: 18 February 2015 + */ +package com.siyeh.ig.performance; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; + +/** + * @author Bas Leijdekkers + */ +public class FieldMayBeStaticInspectionTest extends LightInspectionTestCase { + + public void testFieldMayBeStatic() { + doTest(); + } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new FieldMayBeStaticInspection(); + } +} From 9b93e29bc1a80d77d5ee8dd8580844f096696c2a Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 18 Feb 2015 14:16:24 +0300 Subject: [PATCH 011/106] test fixed under JDK 1.8 --- .../jetbrains/idea/maven/compiler/ManifestGenerationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java index 65b78491237a..2b1e541f3fcb 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java @@ -227,7 +227,7 @@ public class ManifestGenerationTest extends MavenCompilingTestCase { return jdkVersion; } - private static void assertUnorderedLinesWithFile(String filePath, String actualText) { + public static void assertUnorderedLinesWithFile(String filePath, String actualText) { String fileText; try { if (OVERWRITE_TESTDATA) { From e58f25677dd3582e6d479390c65475ad00ceb0f5 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Tue, 17 Feb 2015 15:27:55 +0300 Subject: [PATCH 012/106] PY-15092 Template folders have proper icon in project toolwindow for Python 3 I changed the order of extensions so that TemplateRootIconProvider is always run before PyDirectoryIconProvider. --- python/src/META-INF/python-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/src/META-INF/python-core.xml b/python/src/META-INF/python-core.xml index d19cb22252a8..e5b4e867a861 100644 --- a/python/src/META-INF/python-core.xml +++ b/python/src/META-INF/python-core.xml @@ -477,7 +477,7 @@ - + From 7bf1fc88f64b4978afeb6be5e387d12434e98496 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Tue, 17 Feb 2015 17:08:36 +0300 Subject: [PATCH 013/106] PY-15075 Suggest "import" after dots in relative import only after additional whitespace --- .../completion/PyKeywordCompletionContributor.java | 9 +++++++-- .../jetbrains/python/PythonKeywordCompletionTest.java | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java index 6642636f8bd7..387fc05830aa 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java +++ b/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java @@ -254,8 +254,13 @@ public class PyKeywordCompletionContributor extends CompletionContributor { public static final PsiElementPattern.Capture IN_FROM_IMPORT_AFTER_REF = psiElement().afterLeaf( or(psiElement().withElementType(PyTokenTypes.IDENTIFIER).inside(PyReferenceExpression.class), - psiElement().withElementType(PyTokenTypes.DOT)) - ).inside(PyFromImportStatement.class); + psiElement().with(new PatternCondition("dotFollowedByWhitespace") { + @Override + public boolean accepts(@NotNull PsiElement element, ProcessingContext context) { + return element.getNode().getElementType() == PyTokenTypes.DOT && element.getNextSibling() instanceof PsiWhiteSpace; + } + })) + ).inside(PyFromImportStatement.class); public static final ElementPattern IN_WITH_AFTER_REF = psiElement().afterLeaf(psiElement().inside(psiElement(PyWithItem.class).with(new PatternCondition("withoutAsKeyword") { diff --git a/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java b/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java index e64f02ad16c3..60171fb7c899 100644 --- a/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java +++ b/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java @@ -227,4 +227,13 @@ public class PythonKeywordCompletionTest extends PyTestCase { "finally:\n" + " pass\n"), "except"); } + + // PY-15075 + public void testImportAfterWhitespaceInRelativeImport() { + List variants = doTestByText("from ..."); + assertDoesntContain(variants, "import"); + + variants = doTestByText("from ... "); + assertContainsElements(variants, "import"); + } } From 31bea611fe1ecea9ff29f64cfe4003e96395eb14 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Tue, 17 Feb 2015 17:43:57 +0300 Subject: [PATCH 014/106] PY-3369 Show different icons for functions and methods Actual function icon is taken from database-openapi. --- python/gen/icons/PythonIcons.java | 1 + .../icons/com/jetbrains/python/function.png | Bin 0 -> 403 bytes .../icons/com/jetbrains/python/function@2x.png | Bin 0 -> 847 bytes .../jetbrains/python/psi/impl/PyFunctionImpl.java | 5 ++++- 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 python/resources/icons/com/jetbrains/python/function.png create mode 100644 python/resources/icons/com/jetbrains/python/function@2x.png diff --git a/python/gen/icons/PythonIcons.java b/python/gen/icons/PythonIcons.java index 584c8a9561e4..c6b70836416f 100644 --- a/python/gen/icons/PythonIcons.java +++ b/python/gen/icons/PythonIcons.java @@ -47,6 +47,7 @@ public class PythonIcons { } public static final Icon Dotnet = load("/icons/com/jetbrains/python/dotnet.png"); // 16x16 + public static final Icon Function = load("/icons/com/jetbrains/python/function.png"); // 16x16 public static final Icon InterpreterGear = load("/icons/com/jetbrains/python/interpreterGear.png"); // 16x16 public static final Icon IpythonNotebook = load("/icons/com/jetbrains/python/IpythonNotebook.png"); // 16x16 public static final Icon Jython = load("/icons/com/jetbrains/python/jython.png"); // 16x16 diff --git a/python/resources/icons/com/jetbrains/python/function.png b/python/resources/icons/com/jetbrains/python/function.png new file mode 100644 index 0000000000000000000000000000000000000000..82adbe1dc0b472e281f51ab0a38fd6f9f2a0e2a9 GIT binary patch literal 403 zcmV;E0c`$>P)R&Jk*f(`J4=op7 zvqrT~*E1nNde>El&7e(TaE(2q5P!ftr`xR>aDU~|Osr#5Sw^>V>}l+I8*~!&2c#@x zA80oOR+kp>sP6`J_VS$k0Uf(>3f$H`?zT3dEXYW&t)N@V3pMugko^IDT%Q50a{)z` zVdi!MxT~oVHascjQFw+wqc)S x;gmENUbDuvX;*ptF})JMghf0N>cq!13;)ol;K@n(cJKfI002ovPDHLkV1jDqv5Noz literal 0 HcmV?d00001 diff --git a/python/resources/icons/com/jetbrains/python/function@2x.png b/python/resources/icons/com/jetbrains/python/function@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..92f589d42d89b2f4e276020562b035d585ce0110 GIT binary patch literal 847 zcmV-V1F-ywP)@6KWG^q<_!3y;CNnGj~QvVDU>}=G_1Jcg}sB>jB_7PdpdKz^_oh3NKMhgorQ1 z4sj^ik5T}JW4 z8j9~%@%MFBJmYtJ<3Y0#9$Wpt2CfjhrNl!x$ff{F21=@eV|k1;u`A2s%D`1wTkKCq zQGB;jO6~$4lS_;lCJv>hBLkO-91r}H(p@J$32R6btXZQnaLK6o{>&)Azubb{S_bKd zedxV)6Ix><;=Ok*V_8d@_$G5$8fZ3ZUZjZynrK$c_T8t%4TANde*8@8ma(j5niDNn z2E4{nJIEw}H(6VHZZwJHgRPn}mSIiP67^OxP-pyltUp(xH8cn&dO97&Gp4UlSIGeH zaL6aefmazzHX=bx-Rq*{0YP`ubp+cqEI)c+JC0#(X&_X|z-NA0csc{DEn4y^^jKgR z7|@!<|34-pw&NJqmIgK|8Q}dKM@zKftfrM{fq+2o>2MU!u(mX?Q^|nXc#6yOz{-LW zE#MdE-R+Lz1*C0kOx6aL<|r_wq->z;j-z-1Y1C|KyTNSu?%aPw&E(Q!>C1kg~$Mk^Ao^A>`Y)S z)>Iuv#&OI?CUO%&fK8kMtR<6wR~^S5*))_IlGrei8aowveb`k)Vo+ah$+$O|r8$ut zbp?;fjSrbyvU;~oX}$3!xPAvyBP1Mk1jm|co;#V`OjuL}J{CkFK7yl}Ffbbt z@ZbE5-~B#LY}CAlV$S4ZvhCtxvR%HIB*Gr%GzQE@xWA7On-#8RoAO<)jJ4Ifc$d@j Z;vXdyhb9k55{Uo+002ovPDHLkV1k!Le!>6% literal 0 HcmV?d00001 diff --git a/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java index 2e8e7196a80c..68ad9386e4a4 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java @@ -131,8 +131,11 @@ public class PyFunctionImpl extends PyBaseElementImpl implements } return PlatformIcons.PROPERTY_ICON; } + if (getContainingClass() != null) { + return PlatformIcons.METHOD_ICON; + } } - return PlatformIcons.METHOD_ICON; + return PythonIcons.Python.Function; } @Nullable From 0f90733428b1a0f87bb030feb59a1f14ecbfdd48 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 18 Feb 2015 14:35:49 +0300 Subject: [PATCH 015/106] assert dispatch thread --- .../com/intellij/openapi/fileEditor/impl/EditorComposite.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java index 790160ba9a5a..8c0dcf4df07e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java @@ -457,6 +457,7 @@ public abstract class EditorComposite implements Disposable { } void addEditor(FileEditor editor) { + ApplicationManager.getApplication().assertIsDispatchThread(); FileEditor[] editors = ArrayUtil.append(myEditors, editor); if (myTabbedPaneWrapper == null) { myTabbedPaneWrapper = createTabbedPaneWrapper(editors); From 59ce53fa8fabfcb1407747efb889d2dd3dcc90a9 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 18 Feb 2015 14:35:30 +0300 Subject: [PATCH 016/106] use common 'source package' icon for folders under test roots in 'Project Structure' dialog for consistency --- .../roots/ui/configuration/JavaTestSourceRootEditHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/JavaTestSourceRootEditHandler.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/JavaTestSourceRootEditHandler.java index 569a63b6e31c..9f4b2be1e2e2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/JavaTestSourceRootEditHandler.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/JavaTestSourceRootEditHandler.java @@ -65,7 +65,7 @@ public class JavaTestSourceRootEditHandler extends JavaSourceRootEditHandlerBase @Nullable @Override public Icon getFolderUnderRootIcon() { - return AllIcons.Modules.TestSourceFolder; + return AllIcons.Modules.SourceFolder; } @Override From 851637a794770188729ca1981e2c5f399414b0d5 Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Wed, 18 Feb 2015 14:47:10 +0300 Subject: [PATCH 017/106] WEB-15311 Do not replace WebStorm stable with WebStorm EAP in Mac OS Launchpad. Cleanup. --- build/conf/mac/Contents/Info.plist | 4 ++-- build/scripts/utils.gant | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build/conf/mac/Contents/Info.plist b/build/conf/mac/Contents/Info.plist index 9fcd21c14315..8daa490e8ecc 100644 --- a/build/conf/mac/Contents/Info.plist +++ b/build/conf/mac/Contents/Info.plist @@ -31,11 +31,11 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - @@bundle_name@@ @@product_version@@ + @@bundle_name@@@@product_state@@ CFBundlePackageType APPL CFBundleIdentifier - @@bundle_identifier@@ + @@bundle_identifier@@@@product_state@@ CFBundleSignature ???? CFBundleGetInfoString diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant index f93dd53fa8a2..7421c91f9cc5 100644 --- a/build/scripts/utils.gant +++ b/build/scripts/utils.gant @@ -367,8 +367,7 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args -> String minor = p("component.version.minor") String version = isEap() && !minor.contains("RC") && !minor.contains("Beta") ? "EAP $args.buildNumber" : "${p("component.version.major")}.${minor}" - String productVersion = "${p("component.version.major")}.${minor}" - if (isEap() && !minor.contains("RC") && !minor.contains("Beta")) productVersion += " EAP" + String EAP = isEap() && !minor.contains("RC") && !minor.contains("Beta") ? "-EAP" : "" Map properties = readIdeaProperties(args) @@ -429,7 +428,7 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args -> replacefilter(token: "@@executable@@", value: executable) replacefilter(token: "@@icns@@", value: icns) replacefilter(token: "@@bundle_name@@", value: fullName) - replacefilter(token: "@@product_version@@", value: productVersion) + replacefilter(token: "@@product_state@@", value: EAP) replacefilter(token: "@@bundle_identifier@@", value: args.bundleIdentifier) replacefilter(token: "@@year@@", value: "$todayYear") replacefilter(token: "@@version@@", value: version) From 0dc2382266c30b2400032550595a3507dfa96d69 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Wed, 18 Feb 2015 14:56:21 +0300 Subject: [PATCH 018/106] Default template language background for Darcula --- .../platform-resources/src/DefaultColorSchemesManager.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml index a1d2c4185efe..1c793f12e3ab 100644 --- a/platform/platform-resources/src/DefaultColorSchemesManager.xml +++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml @@ -1558,6 +1558,11 @@ +