diff --git a/colorSchemes/src/colorSchemes/Darcula.xml b/colorSchemes/src/colorSchemes/Darcula.xml
index 61e7c02afd11..236f01df78dc 100644
--- a/colorSchemes/src/colorSchemes/Darcula.xml
+++ b/colorSchemes/src/colorSchemes/Darcula.xml
@@ -362,6 +362,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java b/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java
index 4b76c29ba56f..a9f9d6755f14 100644
--- a/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java
+++ b/java/compiler/impl/src/com/intellij/compiler/options/ProcessedModulesTable.java
@@ -50,7 +50,7 @@ public class ProcessedModulesTable extends JPanel {
myTable.getEmptyText().setText("No modules configured");
//myTable.setShowGrid(false);
- myTable.setIntercellSpacing(new Dimension(0, 0));
+ myTable.setIntercellSpacing(JBUI.emptySize());
myTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
myTable.setColumnSelectionAllowed(false);
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/configurables/NamedChildrenConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/configurables/NamedChildrenConfigurable.java
index fe4861de14eb..f38f6ca4c94d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/configurables/NamedChildrenConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/configurables/NamedChildrenConfigurable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -29,6 +29,7 @@ import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.TableUtil;
import com.intellij.util.ui.AbstractTableCellEditor;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.Table;
import javax.swing.*;
@@ -64,7 +65,7 @@ public class NamedChildrenConfigurable implements UnnamedConfigurable{
myCompletionEditor = ((DebuggerUtilsEx)DebuggerUtils.getInstance()).createEditor(project, psiClass, "NamedChildrenConfigurable");
myTable.setDragEnabled(false);
- myTable.setIntercellSpacing(new Dimension(0, 0));
+ myTable.setIntercellSpacing(JBUI.emptySize());
myTable.getColumn(expressionColumnName).setCellEditor(new AbstractTableCellEditor() {
public Object getCellEditorValue() {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/defaultHashCode.vm b/java/java-impl/src/com/intellij/codeInsight/generation/defaultHashCode.vm
index e4c51becd08c..a37759ce7bd8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/defaultHashCode.vm
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/defaultHashCode.vm
@@ -78,11 +78,12 @@ public int hashCode() {
#end
##
#macro(adjustHashCodeToArrays $field)
-#if ($field.array && $java_version > 4)
-#if ($field.nestedArray)
-// Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
+ #if ($field.array && $java_version > 4)
+ #if ($field.nestedArray)
+ java.util.Arrays.deepHashCode($field.accessor)##
+ #else
+ java.util.Arrays.hashCode($field.accessor)##
#end
- java.util.Arrays.hashCode($field.accessor)##
#else
${field.accessor}.hashCode()##
#end
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/objectsEquals.vm b/java/java-impl/src/com/intellij/codeInsight/generation/objectsEquals.vm
index 5e240f9f73d2..f87075daf08e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/objectsEquals.vm
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/objectsEquals.vm
@@ -13,15 +13,7 @@ Object $paramName){
&&
#end
#set($i = $i + 1)
- #if ($field.array)
- #if ($field.nestedArray)
-java.util.Arrays.deepEquals($field.accessor, ${classInstanceName}.$field.accessor)##
- #else
-java.util.Arrays.equals($field.accessor, ${classInstanceName}.$field.accessor)##
- #end
- #else
java.util.Objects.equals($field.accessor, ${classInstanceName}.$field.accessor)##
- #end
#end
;
}
\ No newline at end of file
diff --git a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocComment.java b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocComment.java
index 081d0ce90206..b727ec7f3806 100644
--- a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocComment.java
+++ b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocComment.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -23,20 +23,40 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+/**
+ * Represents a JavaDoc comment.
+ */
public interface PsiDocComment extends PsiComment, PsiDocCommentBase {
+ /**
+ * Returns the class, method or field described by the comment.
+ */
@Override
@Nullable
PsiDocCommentOwner getOwner();
+ /**
+ * Returns the PSI elements containing the description of the element being documented
+ * (all significant tokens up to the first doc comment tag).
+ */
@NotNull
PsiElement[] getDescriptionElements();
+ /**
+ * Returns the list of JavaDoc tags in the comment.
+ */
@NotNull
PsiDocTag[] getTags();
+ /**
+ * Finds the first JavaDoc tag with the specified name.
+ * @return the tag with the specified name, or null if not found.
+ */
@Nullable
PsiDocTag findTagByName(@NonNls String name);
+ /**
+ * Finds all JavaDoc tags with the specified name.
+ */
@NotNull
PsiDocTag[] findTagsByName(@NonNls String name);
}
\ No newline at end of file
diff --git a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocTag.java b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocTag.java
index f2dfe9165036..6ae7d1321ebb 100644
--- a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocTag.java
+++ b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocTag.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -22,13 +22,38 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public interface PsiDocTag extends PsiElement, PsiNamedElement{
+/**
+ * Represents a JavaDoc tag (either an inline tag or a block tag).
+ */
+public interface PsiDocTag extends PsiElement, PsiNamedElement {
PsiDocTag[] EMPTY_ARRAY = new PsiDocTag[0];
+ /**
+ * Returns the doc comment in which the tag is conained.
+ */
PsiDocComment getContainingComment();
+
+ /**
+ * Returns the token representing the name of this JavaDoc tag.
+ */
PsiElement getNameElement();
+
+ /**
+ * Returns the name of this JavaDoc tag.
+ */
@Override
@NonNls @NotNull String getName();
+
+ /**
+ * Returns the list of all elements representing the contents of a tag.
+ */
PsiElement[] getDataElements();
+
+ /**
+ * Returns the element specifying what exactly is being documented by this tag
+ * (for example, the parameter name for a param tag or the exception name for a throws tag).
+ *
+ * @return the element, or null if the tag structure does not include such an element.
+ */
@Nullable PsiDocTagValue getValueElement();
}
\ No newline at end of file
diff --git a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocToken.java b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocToken.java
index c515bbd58d79..f44565286d81 100644
--- a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocToken.java
+++ b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiDocToken.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -19,8 +19,13 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
/**
+ * Represents a token inside a JavaDoc comment.
+ *
* @author Mike
*/
public interface PsiDocToken extends PsiElement {
+ /**
+ * Returns the element type of this token.
+ */
IElementType getTokenType();
}
diff --git a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiInlineDocTag.java b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiInlineDocTag.java
index 535868cc0b1c..b22b44bd4cf3 100644
--- a/java/java-psi-api/src/com/intellij/psi/javadoc/PsiInlineDocTag.java
+++ b/java/java-psi-api/src/com/intellij/psi/javadoc/PsiInlineDocTag.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -15,5 +15,8 @@
*/
package com.intellij.psi.javadoc;
+/**
+ * Represents an inline JavaDoc tag.
+ */
public interface PsiInlineDocTag extends PsiDocTag {
}
\ No newline at end of file
diff --git a/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java b/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
index 02566166fa28..d11b4a9cf984 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
@@ -204,7 +204,14 @@ public class RedundantCastUtil {
if (rExpr instanceof PsiTypeCastExpression) {
PsiExpression castOperand = ((PsiTypeCastExpression)rExpr).getOperand();
if (castOperand != null) {
- PsiType operandType = castOperand.getType();
+ PsiType operandType;
+ if (castOperand instanceof PsiTypeCastExpression) {
+ final PsiExpression nestedCastOperand = ((PsiTypeCastExpression)castOperand).getOperand();
+ operandType = nestedCastOperand != null ? nestedCastOperand.getType() : null;
+ }
+ else {
+ operandType = castOperand.getType();
+ }
if (operandType != null) {
if (lType != null && TypeConversionUtil.isAssignable(lType, operandType, false)) {
addToResults((PsiTypeCastExpression)rExpr);
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterArraysFromJava15.java b/java/java-tests/testData/codeInsight/generateEquals/afterArraysFromJava15.java
index c97281035edd..dca0073b3c7b 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterArraysFromJava15.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterArraysFromJava15.java
@@ -21,8 +21,7 @@ class Test {
public int hashCode() {
int result = myOs != null ? Arrays.hashCode(myOs) : 0;
- result = 31 * result + (myIIs != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(myIIs) : 0);
+ result = 31 * result + (myIIs != null ? Arrays.deepHashCode(myIIs) : 0);
result = 31 * result + (myIs != null ? Arrays.hashCode(myIs) : 0);
return result;
}
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypes.java b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypes.java
index fc6c3314aeff..b81281d9e49b 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypes.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypes.java
@@ -51,14 +51,11 @@ class A {
int result;
long temp;
result = a1 != null ? Arrays.hashCode(a1) : 0;
- result = 31 * result + (a2 != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a2) : 0);
+ result = 31 * result + (a2 != null ? Arrays.deepHashCode(a2) : 0);
result = 31 * result + (a3 != null ? Arrays.hashCode(a3) : 0);
- result = 31 * result + (a4 != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a4) : 0);
+ result = 31 * result + (a4 != null ? Arrays.deepHashCode(a4) : 0);
result = 31 * result + (a5 != null ? Arrays.hashCode(a5) : 0);
- result = 31 * result + (a6 != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a6) : 0);
+ result = 31 * result + (a6 != null ? Arrays.deepHashCode(a6) : 0);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesAllNotNull.java b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesAllNotNull.java
index 6465e3455ad8..98a7fa6c18bf 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesAllNotNull.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesAllNotNull.java
@@ -51,14 +51,11 @@ class A {
int result;
long temp;
result = Arrays.hashCode(a1);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a2);
+ result = 31 * result + Arrays.deepHashCode(a2);
result = 31 * result + Arrays.hashCode(a3);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a4);
+ result = 31 * result + Arrays.deepHashCode(a4);
result = 31 * result + Arrays.hashCode(a5);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a6);
+ result = 31 * result + Arrays.deepHashCode(a6);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesGetters.java b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesGetters.java
index c807dcf489de..69bf70d1ec08 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesGetters.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesGetters.java
@@ -99,14 +99,11 @@ class A {
int result;
long temp;
result = getA1() != null ? Arrays.hashCode(getA1()) : 0;
- result = 31 * result + (getA2() != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(getA2()) : 0);
+ result = 31 * result + (getA2() != null ? Arrays.deepHashCode(getA2()) : 0);
result = 31 * result + (getA3() != null ? Arrays.hashCode(getA3()) : 0);
- result = 31 * result + (getA4() != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(getA4()) : 0);
+ result = 31 * result + (getA4() != null ? Arrays.deepHashCode(getA4()) : 0);
result = 31 * result + (getA5() != null ? Arrays.hashCode(getA5()) : 0);
- result = 31 * result + (getA6() != null ? // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(getA6()) : 0);
+ result = 31 * result + (getA6() != null ? Arrays.deepHashCode(getA6()) : 0);
result = 31 * result + (int) getA7();
result = 31 * result + (int) getA8();
result = 31 * result + getA9();
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesNoDouble.java b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesNoDouble.java
index 29b89feff7d2..5a3e505e01e8 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesNoDouble.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesNoDouble.java
@@ -47,14 +47,11 @@ class A {
@Override
public int hashCode() {
int result = Arrays.hashCode(a1);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a2);
+ result = 31 * result + Arrays.deepHashCode(a2);
result = 31 * result + Arrays.hashCode(a3);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a4);
+ result = 31 * result + Arrays.deepHashCode(a4);
result = 31 * result + Arrays.hashCode(a5);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a6);
+ result = 31 * result + Arrays.deepHashCode(a6);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesSuperEqualsAndHashCode.java b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesSuperEqualsAndHashCode.java
index 5ce0416adf60..629408b134ca 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesSuperEqualsAndHashCode.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterDifferentTypesSuperEqualsAndHashCode.java
@@ -63,14 +63,11 @@ class A extends B {
int result = super.hashCode();
long temp;
result = 31 * result + Arrays.hashCode(a1);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a2);
+ result = 31 * result + Arrays.deepHashCode(a2);
result = 31 * result + Arrays.hashCode(a3);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a4);
+ result = 31 * result + Arrays.deepHashCode(a4);
result = 31 * result + Arrays.hashCode(a5);
- result = 31 * result + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a6);
+ result = 31 * result + Arrays.deepHashCode(a6);
result = 31 * result + (int) a7;
result = 31 * result + (int) a8;
result = 31 * result + a9;
diff --git a/java/java-tests/testData/codeInsight/generateEquals/afterNameConflicts.java b/java/java-tests/testData/codeInsight/generateEquals/afterNameConflicts.java
index ff36c08a04e0..37194104a2ed 100644
--- a/java/java-tests/testData/codeInsight/generateEquals/afterNameConflicts.java
+++ b/java/java-tests/testData/codeInsight/generateEquals/afterNameConflicts.java
@@ -51,14 +51,11 @@ class A {
int result1;
long temp1;
result1 = Arrays.hashCode(a1);
- result1 = 31 * result1 + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a2);
+ result1 = 31 * result1 + Arrays.deepHashCode(a2);
result1 = 31 * result1 + Arrays.hashCode(a3);
- result1 = 31 * result1 + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a4);
+ result1 = 31 * result1 + Arrays.deepHashCode(a4);
result1 = 31 * result1 + Arrays.hashCode(a5);
- result1 = 31 * result1 + // Probably incorrect - hashCode for high dimension arrays with Arrays.hashCode
- Arrays.hashCode(a6);
+ result1 = 31 * result1 + Arrays.deepHashCode(a6);
result1 = 31 * result1 + (int) a7;
result1 = 31 * result1 + (int) a8;
result1 = 31 * result1 + a9;
diff --git a/java/java-tests/testData/inspection/redundantCast/DoubleCast3/expected.xml b/java/java-tests/testData/inspection/redundantCast/DoubleCast3/expected.xml
index e8c201ce3315..49a614757885 100644
--- a/java/java-tests/testData/inspection/redundantCast/DoubleCast3/expected.xml
+++ b/java/java-tests/testData/inspection/redundantCast/DoubleCast3/expected.xml
@@ -3,12 +3,17 @@
DoubleCast3.java
4
- Casting '(String) o' to String is redundant
+ Casting 'o' to String is redundant
DoubleCast3.java
- 4
- Casting 'o' to String is redundant
+ 6
+ Casting '(String) s' to String is redundant
+
+
+ DoubleCast3.java
+ 6
+ Casting 's' to String is redundant
diff --git a/java/java-tests/testData/inspection/redundantCast/DoubleCast3/src/DoubleCast3.java b/java/java-tests/testData/inspection/redundantCast/DoubleCast3/src/DoubleCast3.java
index 36da9cba2007..a4bcb59f55b0 100644
--- a/java/java-tests/testData/inspection/redundantCast/DoubleCast3/src/DoubleCast3.java
+++ b/java/java-tests/testData/inspection/redundantCast/DoubleCast3/src/DoubleCast3.java
@@ -2,5 +2,7 @@ class Test{
static f(){
Object o;
String s = (String) (String) o;
+
+ String s2 = (String) (String) s;
}
}
diff --git a/lib/src/proxy-vole-20131209-src.zip b/lib/src/proxy-vole-20131209-src.zip
new file mode 100644
index 000000000000..e7455560863d
Binary files /dev/null and b/lib/src/proxy-vole-20131209-src.zip differ
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
index bc18a4241360..0295fee17973 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
@@ -59,7 +59,7 @@ public class OptimizeImportsAction extends AnAction {
if (file == null) return;
dir = file.getContainingDirectory();
}
- else if (files != null && ReformatCodeAction.areFiles(files)) {
+ else if (files != null && ReformatCodeAction.containsAtLeastOneFile(files)) {
final ReadonlyStatusHandler.OperationStatus operationStatus = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(files);
if (!operationStatus.hasReadonlyFiles()) {
new OptimizeImportsProcessor(project, ReformatCodeAction.convertToPsiFiles(files, project), null).run();
@@ -160,7 +160,7 @@ public class OptimizeImportsAction extends AnAction {
return;
}
}
- else if (files != null && ReformatCodeAction.areFiles(files)) {
+ else if (files != null && ReformatCodeAction.containsAtLeastOneFile(files)) {
boolean anyHasOptimizeImports = false;
for (VirtualFile virtualFile : files) {
PsiFile file = PsiManager.getInstance(project).findFile(virtualFile);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
index 78c6b9a6cff6..ba3d2d961f00 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
@@ -88,7 +88,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
dir = file.getContainingDirectory();
hasSelection = editor.getSelectionModel().hasSelection();
}
- else if (areFiles(files)) {
+ else if (containsAtLeastOneFile(files)) {
final ReadonlyStatusHandler.OperationStatus operationStatus = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(files);
if (!operationStatus.hasReadonlyFiles()) {
ReformatFilesOptions selectedFlags = getReformatFilesOptions(project, files);
@@ -118,9 +118,6 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
}
return;
}
- else if (files != null && files.length == 1) {
- file = PsiManager.getInstance(project).findFile(files[0]);
- }
else {
PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
if (element == null) return;
@@ -385,7 +382,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
return;
}
}
- else if (files!= null && areFiles(files)) {
+ else if (files!= null && containsAtLeastOneFile(files)) {
boolean anyFormatters = false;
for (VirtualFile virtualFile : files) {
if (virtualFile.isDirectory()) {
@@ -490,9 +487,9 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
myTestOptions = options;
}
- public static boolean areFiles(final VirtualFile[] files) {
+ public static boolean containsAtLeastOneFile(final VirtualFile[] files) {
if (files == null) return false;
- if (files.length < 2) return false;
+ if (files.length < 1) return false;
for (VirtualFile virtualFile : files) {
if (virtualFile.isDirectory()) return false;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/NavigationUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/NavigationUtil.java
index e8774cedeeb8..2bbbd2ca8869 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/NavigationUtil.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/NavigationUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -175,7 +175,6 @@ public final class NavigationUtil {
return false;
}
-
private static boolean activatePsiElementIfOpen(@NotNull PsiElement elt, boolean searchForOpen, boolean requestFocus) {
if (!elt.isValid()) return false;
elt = elt.getNavigationElement();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
index d310851b8965..24efa6e9dd93 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
+import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.Alarm;
import com.intellij.util.NullableFunction;
import com.intellij.util.ObjectUtils;
@@ -947,20 +948,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
void selectNode(@NotNull String searchQuery) {
- for (TemplateGroup group : myTemplateGroups) {
- for (TemplateImpl template : group.getElements()) {
- if (StringUtil.startsWithIgnoreCase(template.getKey(), searchQuery)) {
- selectTemplate(group.getName(), template.getKey());
- return;
- }
- }
- }
- for (TemplateGroup group : myTemplateGroups) {
- if (StringUtil.startsWithIgnoreCase(group.getName(), searchQuery)) {
- selectTemplate(group.getName(), null);
- return;
- }
- }
+ ObjectUtils.assertNotNull(SpeedSearchSupply.getSupply(myTree, true)).findAndSelectElement(searchQuery);
}
private void selectTemplate(@Nullable final String groupName, @Nullable final String templateKey) {
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java
index 24d7a09942df..a6c296bba9f4 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.ide.actions;
import com.intellij.codeInsight.navigation.NavigationUtil;
import com.intellij.featureStatistics.FeatureUsageTracker;
+import com.intellij.ide.IdeBundle;
import com.intellij.ide.structureView.StructureView;
import com.intellij.ide.structureView.StructureViewBuilder;
import com.intellij.ide.structureView.StructureViewTreeElement;
@@ -29,7 +29,6 @@ import com.intellij.lang.LanguageStructureViewBuilder;
import com.intellij.lang.PsiStructureViewFactory;
import com.intellij.navigation.AnonymousElementProvider;
import com.intellij.navigation.ChooseByNameRegistry;
-import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.NavigationItem;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.AccessToken;
@@ -53,34 +52,38 @@ import com.intellij.psi.util.PsiUtilCore;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.awt.*;
+import java.awt.event.InputEvent;
import java.util.ArrayList;
import java.util.List;
public class GotoClassAction extends GotoActionBase implements DumbAware {
@Override
- public void actionPerformed(@NotNull final AnActionEvent e) {
- final Project project = e.getData(CommonDataKeys.PROJECT);
- assert project != null;
+ public void actionPerformed(@NotNull AnActionEvent e) {
+ Project project = e.getProject();
+ if (project == null) return;
+
if (!DumbService.getInstance(project).isDumb()) {
super.actionPerformed(e);
}
else {
- DumbService.getInstance(project)
- .showDumbModeNotification("Goto Class action is not available until indices are built, using Goto File instead");
- ActionManager.getInstance()
- .tryToExecute(ActionManager.getInstance().getAction(GotoFileAction.ID), ActionCommand.getInputEvent(GotoFileAction.ID),
- e.getData(PlatformDataKeys.CONTEXT_COMPONENT), e.getPlace(), true);
+ DumbService.getInstance(project).showDumbModeNotification(IdeBundle.message("go.to.class.dumb.mode.message"));
+ AnAction action = ActionManager.getInstance().getAction(GotoFileAction.ID);
+ InputEvent event = ActionCommand.getInputEvent(GotoFileAction.ID);
+ Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
+ ActionManager.getInstance().tryToExecute(action, event, component, e.getPlace(), true);
}
}
@Override
- public void gotoActionPerformed(AnActionEvent e) {
- final Project project = e.getData(CommonDataKeys.PROJECT);
- assert project != null;
+ public void gotoActionPerformed(@NotNull AnActionEvent e) {
+ final Project project = e.getProject();
+ if (project == null) return;
+
+ FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.class");
PsiDocumentManager.getInstance(project).commitAllDocuments();
- FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.class");
final GotoClassModel2 model = new GotoClassModel2(project);
showNavigationPopup(e, model, new GotoActionCallback() {
@Override
@@ -93,17 +96,20 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
AccessToken token = ReadAction.start();
try {
if (element instanceof PsiElement) {
- final PsiElement psiElement = getElement(((PsiElement)element), popup);
- final VirtualFile file = PsiUtilCore.getVirtualFile(psiElement);
- if (popup.getLinePosition() != -1 && file != null) {
- Navigatable n = new OpenFileDescriptor(project, file, popup.getLinePosition(), popup.getColumnPosition()).setUseCurrentWindow(
- popup.isOpenInCurrentWindowRequested());
+ PsiElement psiElement = getElement(((PsiElement)element), popup);
+ psiElement = psiElement.getNavigationElement();
+ VirtualFile file = PsiUtilCore.getVirtualFile(psiElement);
+
+ if (file != null && popup.getLinePosition() != -1) {
+ OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file, popup.getLinePosition(), popup.getColumnPosition());
+ Navigatable n = descriptor.setUseCurrentWindow(popup.isOpenInCurrentWindowRequested());
if (n.canNavigate()) {
n.navigate(true);
return;
}
}
- if (psiElement != null && file != null && popup.getMemberPattern() != null) {
+
+ if (file != null && popup.getMemberPattern() != null) {
NavigationUtil.activateFileWithPsiElement(psiElement, !popup.isOpenInCurrentWindowRequested());
Navigatable member = findMember(popup.getMemberPattern(), psiElement, file);
if (member != null) {
@@ -121,10 +127,11 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
token.finish();
}
}
- }, "Classes matching pattern", true);
+ }, IdeBundle.message("go.to.class.toolwindow.title"), true);
}
- @Nullable private static Navigatable findMember(String pattern, PsiElement psiElement, VirtualFile file) {
+ @Nullable
+ private static Navigatable findMember(String pattern, PsiElement psiElement, VirtualFile file) {
final PsiStructureViewFactory factory = LanguageStructureViewBuilder.INSTANCE.forLanguage(psiElement.getLanguage());
final StructureViewBuilder builder = factory == null ? null : factory.getStructureViewBuilder(psiElement.getContainingFile());
final FileEditor[] editors = FileEditorManager.getInstance(psiElement.getProject()).getEditors(file);
@@ -144,8 +151,7 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
Object target = null;
for (TreeElement treeElement : element.getChildren()) {
if (treeElement instanceof StructureViewTreeElement) {
- final ItemPresentation presentation = treeElement.getPresentation();
- String presentableText = presentation == null ? null : presentation.getPresentableText();
+ String presentableText = treeElement.getPresentation().getPresentableText();
if (presentableText != null) {
final int degree = matcher.matchingDegree(presentableText);
if (degree > max) {
@@ -181,6 +187,7 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
return null;
}
+ @NotNull
private static PsiElement getElement(@NotNull PsiElement element, ChooseByNamePopup popup) {
final String path = popup.getPathToAnonymous();
if (path != null) {
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoFileAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoFileAction.java
index 280e4c7736b1..e43d45ada6d8 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoFileAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoFileAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -13,11 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.ide.actions;
import com.intellij.featureStatistics.FeatureUsageTracker;
-import com.intellij.ide.util.gotoByName.*;
+import com.intellij.ide.IdeBundle;
+import com.intellij.ide.util.gotoByName.ChooseByNameFilter;
+import com.intellij.ide.util.gotoByName.ChooseByNamePopup;
+import com.intellij.ide.util.gotoByName.GotoFileConfiguration;
+import com.intellij.ide.util.gotoByName.GotoFileModel;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ApplicationManager;
@@ -30,7 +33,6 @@ import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
-import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -52,8 +54,11 @@ public class GotoFileAction extends GotoActionBase implements DumbAware {
@Override
public void gotoActionPerformed(AnActionEvent e) {
- FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file");
final Project project = e.getData(CommonDataKeys.PROJECT);
+ if (project == null) return;
+
+ FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file");
+
final GotoFileModel gotoFileModel = new GotoFileModel(project);
GotoActionCallback callback = new GotoActionCallback() {
@Override
@@ -71,9 +76,10 @@ public class GotoFileAction extends GotoActionBase implements DumbAware {
//this is for better cursor position
if (element instanceof PsiFile) {
- VirtualFile vfile = ((PsiFile)element).getVirtualFile();
- if (vfile == null) return;
- n = new OpenFileDescriptor(project, vfile, popup.getLinePosition(), popup.getColumnPosition()).setUseCurrentWindow(popup.isOpenInCurrentWindowRequested());
+ VirtualFile file = ((PsiFile)element).getVirtualFile();
+ if (file == null) return;
+ OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file, popup.getLinePosition(), popup.getColumnPosition());
+ n = descriptor.setUseCurrentWindow(popup.isOpenInCurrentWindowRequested());
}
if (!n.canNavigate()) return;
@@ -82,8 +88,8 @@ public class GotoFileAction extends GotoActionBase implements DumbAware {
}, ModalityState.NON_MODAL);
}
};
- PsiElement context = getPsiContext(e);
- showNavigationPopup(e, gotoFileModel, callback, "Files matching pattern", true, true, new GotoFileItemProvider(project, context));
+ GotoFileItemProvider provider = new GotoFileItemProvider(project, getPsiContext(e));
+ showNavigationPopup(e, gotoFileModel, callback, IdeBundle.message("go.to.file.toolwindow.title"), true, true, provider);
}
protected static class GotoFileFilter extends ChooseByNameFilter {
@@ -148,5 +154,4 @@ public class GotoFileAction extends GotoActionBase implements DumbAware {
return o1.getName().compareToIgnoreCase(o2.getName());
}
}
-
}
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java
index fbf057f50acc..654490929110 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java
+++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -36,21 +36,17 @@ import java.util.List;
public class OpenFileDescriptor implements Navigatable {
/**
- * Tells descriptor to navigate in specific editor rather than file editor
- * in main IDEA window.
- * For example if you want to navigate in editor embedded into modal dialog,
- * you should provide this data.
+ * Tells descriptor to navigate in specific editor rather than file editor in main IDEA window.
+ * For example if you want to navigate in editor embedded into modal dialog, you should provide this data.
*/
public static final DataKey NAVIGATE_IN_EDITOR = DataKey.create("NAVIGATE_IN_EDITOR");
- @NotNull
+ private final Project myProject;
private final VirtualFile myFile;
- private final int myOffset;
private final int myLogicalLine;
private final int myLogicalColumn;
+ private final int myOffset;
private final RangeMarker myRangeMarker;
- @NotNull
- private final Project myProject;
private boolean myUseCurrentWindow = false;
@@ -62,8 +58,7 @@ public class OpenFileDescriptor implements Navigatable {
this(project, file, logicalLine, logicalColumn, -1, false);
}
- public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file,
- int logicalLine, int logicalColumn, boolean persistent) {
+ public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, int logicalLine, int logicalColumn, boolean persistent) {
this(project, file, logicalLine, logicalColumn, -1, persistent);
}
@@ -71,10 +66,8 @@ public class OpenFileDescriptor implements Navigatable {
this(project, file, -1, -1, -1, false);
}
- private OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file,
- int logicalLine, int logicalColumn, int offset, boolean persistent) {
+ private OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, int logicalLine, int logicalColumn, int offset, boolean persistent) {
myProject = project;
-
myFile = file;
myLogicalLine = logicalLine;
myLogicalColumn = logicalColumn;
@@ -139,7 +132,7 @@ public class OpenFileDescriptor implements Navigatable {
}
private boolean navigateInRequestedEditor() {
- DataContext ctx = DataManager.getInstance().getDataContext();
+ @SuppressWarnings("deprecation") DataContext ctx = DataManager.getInstance().getDataContext();
Editor e = NAVIGATE_IN_EDITOR.getData(ctx);
if (e == null) return false;
if (!Comparing.equal(FileDocumentManager.getInstance().getFile(e.getDocument()), myFile)) return false;
diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java
index 736c4db0b677..75ffa534737e 100644
--- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java
+++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java
@@ -80,4 +80,10 @@ public abstract class SpeedSearchSupply {
public abstract void addChangeListener(@NotNull PropertyChangeListener listener);
public abstract void removeChangeListener(@NotNull PropertyChangeListener listener);
+
+ /**
+ * Find an element matching the searching query in the underlying component and select it there. Speed-search popup is not affected.
+ * @param searchQuery text that the selected element should match
+ */
+ public abstract void findAndSelectElement(@NotNull String searchQuery);
}
diff --git a/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java b/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java
index 340fbb9ae186..8d8fa2d6797b 100644
--- a/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -21,6 +21,7 @@ import com.intellij.ide.IdeBundle;
import com.intellij.ide.plugins.HelpSetPath;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
+import com.intellij.internal.statistic.UsageTrigger;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.diagnostic.Logger;
@@ -49,6 +50,8 @@ public class HelpManagerImpl extends HelpManager {
private Object myFXHelpBrowser = null;
public void invokeHelp(@Nullable String id) {
+ UsageTrigger.trigger("ide.help." + id);
+
if (myHelpSet == null) {
myHelpSet = createHelpSet();
}
diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationSearchableOptionContributor.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationSearchableOptionContributor.java
new file mode 100644
index 000000000000..b08890a14d61
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationSearchableOptionContributor.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+package com.intellij.notification.impl;
+
+import com.intellij.ide.ui.search.SearchableOptionContributor;
+import com.intellij.ide.ui.search.SearchableOptionProcessor;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author peter
+ */
+public class NotificationSearchableOptionContributor extends SearchableOptionContributor {
+ @Override
+ public void processOptions(@NotNull SearchableOptionProcessor processor) {
+ for (NotificationSettings settings : NotificationsConfigurationImpl.getInstanceImpl().getAllSettings()) {
+ processor.addOptions(settings.getGroupId(), null, settings.getGroupId() + " notifications", NotificationsConfigurable.ID, NotificationsConfigurable.DISPLAY_NAME, true);
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java
index 17f6f42cb4df..99871d163225 100644
--- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java
+++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java
@@ -30,6 +30,7 @@ import javax.swing.*;
*/
public class NotificationsConfigurable implements Configurable, SearchableConfigurable, Configurable.NoScroll {
public static final String DISPLAY_NAME = "Notifications";
+ static final String ID = "reference.settings.ide.settings.notifications";
private NotificationsConfigurablePanel myComponent;
@Override
@@ -41,7 +42,7 @@ public class NotificationsConfigurable implements Configurable, SearchableConfig
@Override
@NotNull
public String getHelpTopic() {
- return "reference.settings.ide.settings.notifications";
+ return ID;
}
@Override
@@ -82,6 +83,11 @@ public class NotificationsConfigurable implements Configurable, SearchableConfig
@Override
public Runnable enableSearch(final String option) {
- return null;
+ return new Runnable() {
+ @Override
+ public void run() {
+ myComponent.selectGroup(option);
+ }
+ };
}
}
diff --git a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsConfigurablePanel.java b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsConfigurablePanel.java
index 7931606053e5..1706376cc8e0 100644
--- a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsConfigurablePanel.java
+++ b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsConfigurablePanel.java
@@ -23,6 +23,8 @@ import com.intellij.openapi.ui.ComboBoxTableRenderer;
import com.intellij.openapi.ui.StripeTable;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.*;
+import com.intellij.ui.speedSearch.SpeedSearchSupply;
+import com.intellij.util.ObjectUtils;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -427,4 +429,8 @@ public class NotificationsConfigurablePanel extends JPanel implements Disposable
return result;
}
}
+
+ public void selectGroup(String searchQuery) {
+ ObjectUtils.assertNotNull(SpeedSearchSupply.getSupply(myTable, true)).findAndSelectElement(searchQuery);
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/LineExtensionInfo.java b/platform/platform-impl/src/com/intellij/openapi/editor/LineExtensionInfo.java
index f84502097b10..86a80c702585 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/LineExtensionInfo.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/LineExtensionInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -16,6 +16,7 @@
package com.intellij.openapi.editor;
import com.intellij.openapi.editor.markup.EffectType;
+import com.intellij.openapi.editor.markup.TextAttributes;
import org.intellij.lang.annotations.JdkConstants;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -43,6 +44,13 @@ public class LineExtensionInfo {
myEffectColor = effectColor;
myFontType = fontType;
}
+ public LineExtensionInfo(@NotNull String text, @NotNull TextAttributes attr) {
+ myText = text;
+ myColor = attr.getForegroundColor();
+ myEffectType = attr.getEffectType();
+ myEffectColor = attr.getEffectColor();
+ myFontType = attr.getFontType();
+ }
@NotNull
public String getText() {
diff --git a/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java b/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java
index 6ee1ded56642..7170e20b9d7f 100644
--- a/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java
+++ b/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java
@@ -338,6 +338,11 @@ public abstract class SpeedSearchBase extends SpeedSear
if ( mySearchPopup != null ) mySearchPopup.refreshSelection();
}
+ @Override
+ public void findAndSelectElement(@NotNull String searchQuery) {
+ selectElement(findElement(searchQuery), searchQuery);
+ }
+
private class SearchPopup extends JPanel {
private final SearchField mySearchField;
@@ -425,7 +430,7 @@ public abstract class SpeedSearchBase extends SpeedSear
}
public void refreshSelection () {
- updateSelection(findElement(mySearchField.getText()));
+ findAndSelectElement(mySearchField.getText());
}
private void updateSelection(Object element) {
diff --git a/platform/platform-impl/src/com/intellij/ui/content/ContentManagerUtil.java b/platform/platform-impl/src/com/intellij/ui/content/ContentManagerUtil.java
index b1a1a2f8a2eb..9129f3c3bb73 100644
--- a/platform/platform-impl/src/com/intellij/ui/content/ContentManagerUtil.java
+++ b/platform/platform-impl/src/com/intellij/ui/content/ContentManagerUtil.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ex.ToolWindowEx;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
+import com.intellij.util.ObjectUtils;
public class ContentManagerUtil {
private ContentManagerUtil() {
@@ -43,18 +44,14 @@ public class ContentManagerUtil {
id = mgr.getLastActiveToolWindowId();
}
}
- if(id == null){
+
+ ToolWindowEx toolWindow = id != null ? (ToolWindowEx)mgr.getToolWindow(id) : null;
+ if (requiresVisibleToolWindow && (toolWindow == null || !toolWindow.isVisible())) {
return null;
}
- ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);
- if (requiresVisibleToolWindow && !toolWindow.isVisible()) {
- return null;
- }
-
- final ContentManager fromContext = PlatformDataKeys.CONTENT_MANAGER.getData(dataContext);
- if (fromContext != null) return fromContext;
-
- return toolWindow != null ? toolWindow.getContentManager() : null;
+ ContentManager fromToolWindow = toolWindow != null ? toolWindow.getContentManager() : null;
+ ContentManager fromContext = PlatformDataKeys.CONTENT_MANAGER.getData(dataContext);
+ return ObjectUtils.chooseNotNull(fromContext, fromToolWindow);
}
}
diff --git a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
index 27c63d468cee..e4b7a13e25eb 100644
--- a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -35,6 +35,7 @@ import com.intellij.ui.switcher.SwitchProvider;
import com.intellij.ui.switcher.SwitchTarget;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -100,7 +101,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
myFocusProxy = new Wrapper.FocusHolder();
myFocusProxy.setOpaque(false);
- myFocusProxy.setPreferredSize(new Dimension(0, 0));
+ myFocusProxy.setPreferredSize(JBUI.emptySize());
MyContentComponent contentComponent = new MyContentComponent();
contentComponent.setContent(myUI.getComponent());
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
index d95c5dc22b38..5a5680cffa7e 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -49,6 +49,7 @@ import com.intellij.util.IJSwingUtilities;
import com.intellij.util.Processor;
import com.intellij.util.ui.ChildFocusWatcher;
import com.intellij.util.ui.EmptyIcon;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -292,7 +293,7 @@ public class AbstractPopup implements JBPopup {
else {
myCaption = new CaptionPanel();
myCaption.setBorder(null);
- myCaption.setPreferredSize(new Dimension(0, 0));
+ myCaption.setPreferredSize(JBUI.emptySize());
}
setWindowActive(myHeaderAlwaysFocusable);
diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties
index 7af9239acdc0..49dede6c95ca 100644
--- a/platform/platform-resources-en/src/messages/IdeBundle.properties
+++ b/platform/platform-resources-en/src/messages/IdeBundle.properties
@@ -1166,3 +1166,7 @@ new.dir.project.chooser.title=Select Location for Project Directory
new.dir.project.default.generator=Empty project
new.dir.project.error.empty=Project name can't be empty
new.dir.project.error.buck=Project directory name must not contain the ''$'' character
+
+go.to.file.toolwindow.title=Files matching pattern
+go.to.class.toolwindow.title=Classes matching pattern
+go.to.class.dumb.mode.message=Go To Class action is not available until indices are built, using Go To File instead
diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties
index cb27a90f5dd7..b51a7a78bb5b 100644
--- a/platform/platform-resources-en/src/messages/OptionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties
@@ -95,6 +95,9 @@ options.java.attribute.descriptor.bad.character=Bad character
options.java.attribute.descriptor.breakpoint.line=Breakpoint line
options.java.attribute.descriptor.execution.point=Execution point
options.java.attribute.descriptor.not.top.frame=Not top frame
+options.java.attribute.descriptor.inlined.values=Inlined values
+options.java.attribute.descriptor.inlined.values.modified=Inlined modified values
+options.java.attribute.descriptor.inlined.values.execution.line=Inlined values for breakpoint line
options.java.attribute.descriptor.recursive.call=Recursive calls highlighting
options.java.attribute.descriptor.annotation.name=Annotation name
options.java.attribute.descriptor.annotation.attribute.name=Annotation attribute name
diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml
index 06e6feb837d9..83962be2446e 100644
--- a/platform/platform-resources/src/DefaultColorSchemesManager.xml
+++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml
@@ -33,6 +33,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
index d383db2838f0..5bd41b391f08 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
@@ -241,6 +241,7 @@
displayName="Notifications"
id="reference.settings.ide.settings.notifications"
provider="com.intellij.notification.impl.NotificationsConfigurableProvider"/>
+
+
+
diff --git a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java
index 284c8edabb92..5e552ec0002e 100644
--- a/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java
+++ b/platform/testFramework/testSrc/com/intellij/openapi/keymap/KeymapsTestCase.java
@@ -565,16 +565,16 @@ public abstract class KeymapsTestCase extends PlatformTestCase {
);
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
- Map> reassignedShortcuts = new FactoryMap>() {
+ Map> reassignedShortcuts = new FactoryMap>() {
@Override
- protected Map> createMap() {
- return new LinkedHashMap>();
+ protected Map> createMap() {
+ return new LinkedHashMap>();
}
@Nullable
@Override
- protected List create(String key) {
- return new ArrayList();
+ protected List create(Keymap key) {
+ return new ArrayList();
}
};
for (String name : duplicates.keySet()) {
@@ -597,7 +597,7 @@ public abstract class KeymapsTestCase extends PlatformTestCase {
Set expectedSc = new HashSet(shortcutMappings.getValue());
for (String s : actualSc) {
if (!expectedSc.contains(s)) {
- reassignedShortcuts.get(keymap.getName()).add(getText(shortcut));
+ reassignedShortcuts.get(keymap).add(shortcut);
}
}
for (String s : expectedSc) {
@@ -610,11 +610,19 @@ public abstract class KeymapsTestCase extends PlatformTestCase {
}
if (!reassignedShortcuts.isEmpty()) {
StringBuilder message = new StringBuilder();
- for (Map.Entry> keymapToShortcuts : reassignedShortcuts.entrySet()) {
- message.append("The following shortcuts was reassigned in keymap ").append(keymapToShortcuts.getKey())
+ for (Map.Entry> keymapToShortcuts : reassignedShortcuts.entrySet()) {
+ Keymap keymap = keymapToShortcuts.getKey();
+ message.append("The following shortcuts was reassigned in keymap ").append(keymap.getName())
.append(". Please modify known duplicates list:\n");
- for (String eachShortcut : keymapToShortcuts.getValue()) {
- message.append(eachShortcut).append("\n");
+ for (Shortcut eachShortcut : keymapToShortcuts.getValue()) {
+ message.append(" { ").append(StringUtil.wrapWithDoubleQuote(getText(eachShortcut))).append(",\t")
+ .append(StringUtil.join(keymap.getActionIds(eachShortcut), new Function() {
+ @Override
+ public String fun(String s) {
+ return StringUtil.wrapWithDoubleQuote(s);
+ }
+ }, ", "))
+ .append("},\n");
}
}
TestCase.fail("\n" + message.toString());
diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties
index 5672a386c9dd..2aabfad8c11d 100644
--- a/platform/util/resources/misc/registry.properties
+++ b/platform/util/resources/misc/registry.properties
@@ -45,14 +45,6 @@ ide.firstStartup=true
ide.debugMode=false
ide.debugger.inline=true
ide.debugger.inline.description=Enables variables view in editor
-ide.debugger.inline.fg.color=134,134,134
-ide.debugger.inline.fg.color.description=Inline values foreground
-ide.debugger.inline.dark.fg.color=61,128,101
-ide.debugger.inline.dark.fg.color.description=Inline values foreground for dark editor scheme
-ide.debugger.inline.fg.modified.color=202,128,33
-ide.debugger.inline.fg.modified.color.description=Inline modified values foreground
-ide.debugger.inline.dark.fg.modified.color=202,126,3
-ide.debugger.inline.dark.fg.modified.color.description=Inline modified values foreground for dark editor scheme
ide.debugMode.description=Record additional information to make bug reports more informative.
ide.forcedShowTooltip=alt
diff --git a/platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java b/platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java
index 89a649e13715..16371ceaaac2 100644
--- a/platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java
+++ b/platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * 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.
@@ -54,7 +54,7 @@ public abstract class AbstractLayoutManager implements LayoutManager2 {
@Override
public Dimension minimumLayoutSize(final Container parent) {
- return new Dimension(0, 0);
+ return JBUI.emptySize();
}
}
diff --git a/platform/util/src/com/intellij/util/ui/Layers.java b/platform/util/src/com/intellij/util/ui/Layers.java
index f546d83961eb..447c85f971e2 100644
--- a/platform/util/src/com/intellij/util/ui/Layers.java
+++ b/platform/util/src/com/intellij/util/ui/Layers.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * 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.
@@ -31,7 +31,7 @@ public class Layers extends JLayeredPane {
@Override
public Dimension getMinimumSize() {
if (!isMinimumSizeSet())
- return new Dimension(0, 0);
+ return JBUI.emptySize();
return super.getMinimumSize();
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java
index afbe74aaff2f..b18b0a680c4b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -56,6 +56,7 @@ import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.util.Alarm;
import com.intellij.util.messages.MessageBusConnection;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import org.intellij.lang.annotations.JdkConstants;
@@ -361,7 +362,7 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
if (myProgressLabel != null) {
myProgressLabel.removeAll();
myProgressLabel.add(progress.create());
- myProgressLabel.setMinimumSize(new Dimension(0, 0));
+ myProgressLabel.setMinimumSize(JBUI.emptySize());
}
}
});
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsDirectoryConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsDirectoryConfigurationPanel.java
index 81ecb76e7986..c324139587a2 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsDirectoryConfigurationPanel.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsDirectoryConfigurationPanel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -300,7 +300,7 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
}
myDirectoryMappingTable = new TableView();
- myDirectoryMappingTable.setIntercellSpacing(new Dimension(0, 0));
+ myDirectoryMappingTable.setIntercellSpacing(JBUI.emptySize());
myBaseRevisionTexts = new JCheckBox("Store on shelf base revision texts for files under DVCS");
myLimitHistory = new VcsLimitHistoryConfigurable(myProject);
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
index ceaf8707d6a3..f4448c9736d5 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -32,6 +32,7 @@ import com.intellij.util.Function;
import com.intellij.util.NotNullProducer;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.DateFormatUtil;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcs.log.VcsFullCommitDetails;
import com.intellij.vcs.log.VcsLogHighlighter;
@@ -114,7 +115,7 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
setRowHeight(HEIGHT_CELL);
setShowHorizontalLines(false);
- setIntercellSpacing(new Dimension(0, 0));
+ setIntercellSpacing(JBUI.emptySize());
MouseAdapter mouseAdapter = new MyMouseAdapter();
addMouseMotionListener(mouseAdapter);
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/ui/DebuggerColors.java b/platform/xdebugger-api/src/com/intellij/xdebugger/ui/DebuggerColors.java
index f71f8b0cf1bb..8322ff735434 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/ui/DebuggerColors.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/ui/DebuggerColors.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -36,4 +36,7 @@ public interface DebuggerColors {
Key BREAKPOINT_HIGHLIGHTER_KEY = Key.create("BREAKPOINT_HIGHLIGHTER_KEY");
int EXECUTION_LINE_HIGHLIGHTERLAYER = HighlighterLayer.SELECTION - 1;
+ TextAttributesKey INLINED_VALUES = TextAttributesKey.createTextAttributesKey("DEBUGGER_INLINED_VALUES");
+ TextAttributesKey INLINED_VALUES_MODIFIED = TextAttributesKey.createTextAttributesKey("DEBUGGER_INLINED_VALUES_MODIFIED");
+ TextAttributesKey INLINED_VALUES_EXECUTION_LINE = TextAttributesKey.createTextAttributesKey("DEBUGGER_INLINED_VALUES_EXECUTION_LINE");
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java
index 047cbb1831b2..922760e5f413 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * 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.
@@ -19,6 +19,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.EditorLinePainter;
import com.intellij.openapi.editor.LineExtensionInfo;
import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
@@ -26,10 +27,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.ui.ColorUtil;
-import com.intellij.ui.JBColor;
-import com.intellij.ui.SimpleColoredText;
-import com.intellij.ui.SimpleTextAttributes;
+import com.intellij.ui.*;
import com.intellij.util.NotNullProducer;
import com.intellij.util.containers.ObjectLongHashMap;
import com.intellij.xdebugger.XDebugSession;
@@ -40,6 +38,7 @@ import com.intellij.xdebugger.impl.frame.XDebugView;
import com.intellij.xdebugger.impl.frame.XVariablesView;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueTextRendererImpl;
+import com.intellij.xdebugger.ui.DebuggerColors;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
@@ -102,7 +101,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
}
XDebugSession session = XDebugView.getSession(values.iterator().next().getTree());
boolean isTopFrame = session instanceof XDebugSessionImpl && ((XDebugSessionImpl)session).isTopFrameSelected();
- final Color color = bpLine == lineNumber && isTopFrame ? new JBColor(new Color(0, 255, 86), new Color(255, 235, 9)) : getForeground();
+ final TextAttributes attributes = bpLine == lineNumber && isTopFrame ? getTopFrameSelectedAttributes() : getNormalAttributes();
final String name = value.getName();
if (StringUtil.isEmpty(text.toString())) {
@@ -110,7 +109,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
}
final VariableText res = new VariableText();
result.add(res);
- res.add(new LineExtensionInfo(" " + name + ": ", color, null, null, Font.ITALIC));
+ res.add(new LineExtensionInfo(" " + name + ": ", attributes));
Variable var = new Variable(name, lineNumber);
VariableValue variableValue = oldValues.get(var);
@@ -126,7 +125,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
if (!variableValue.isChanged()) {
for (String s : text.getTexts()) {
- res.add(new LineExtensionInfo(s, color, null, null, Font.ITALIC));
+ res.add(new LineExtensionInfo(s, attributes));
}
}
else {
@@ -167,28 +166,43 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
return ColorUtil.isDark(bg);
}
- public static JBColor getForeground() {
- return new JBColor(new NotNullProducer() {
- @SuppressWarnings("UseJBColor")
- @NotNull
- @Override
- public Color produce() {
- return isDarkEditor() ? Registry.getColor("ide.debugger.inline.dark.fg.color", new Color(0x3d8065))
- : Registry.getColor("ide.debugger.inline.fg.color", new Color(0x3d8065));
- }
- });
+ public static TextAttributes getNormalAttributes() {
+ TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES);
+ if (attributes == null || attributes.getForegroundColor() == null) {
+ return new TextAttributes(new JBColor(new NotNullProducer() {
+ @SuppressWarnings("UseJBColor")
+ @NotNull
+ @Override
+ public Color produce() {
+ return isDarkEditor() ? new Color(0x3d8065) : Gray._135;
+ }
+ }), null, null, null, Font.ITALIC);
+ }
+ return attributes;
}
- public static JBColor getChangedForeground() {
- return new JBColor(new NotNullProducer() {
- @SuppressWarnings("UseJBColor")
- @NotNull
- @Override
- public Color produce() {
- return isDarkEditor() ? Registry.getColor("ide.debugger.inline.dark.fg.modified.color", new Color(0xa1830a))
- : Registry.getColor("ide.debugger.inline.fg.modified.color", new Color(0xca8021));
- }
- });
+ public static TextAttributes getChangedAttributes() {
+ TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES_MODIFIED);
+ if (attributes == null || attributes.getForegroundColor() == null) {
+ return new TextAttributes(new JBColor(new NotNullProducer() {
+ @SuppressWarnings("UseJBColor")
+ @NotNull
+ @Override
+ public Color produce() {
+ return isDarkEditor() ? new Color(0xa1830a) : new Color(0xca8021);
+ }
+ }), null, null, null, Font.ITALIC);
+ }
+ return attributes;
+ }
+
+ private static TextAttributes getTopFrameSelectedAttributes() {
+ TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES_EXECUTION_LINE);
+ if (attributes == null || attributes.getForegroundColor() == null) {
+ //noinspection UseJBColor
+ return new TextAttributes(isDarkEditor() ? new Color(255, 235, 9) : new Color(0, 255, 86), null, null, null, Font.ITALIC);
+ }
+ return attributes;
}
static class Variable {
@@ -240,22 +254,22 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
if (isArray(actual) && isArray(old)) {
List actualParts = getArrayParts(actual);
List oldParts = getArrayParts(old);
- result.add(new LineExtensionInfo("{", getForeground(), null, null, Font.ITALIC));
+ result.add(new LineExtensionInfo("{", getNormalAttributes()));
for (int i = 0; i < actualParts.size(); i++) {
if (i < oldParts.size() && StringUtil.equals(actualParts.get(i), oldParts.get(i))) {
- result.add(new LineExtensionInfo(actualParts.get(i), getForeground(), null, null, Font.ITALIC));
+ result.add(new LineExtensionInfo(actualParts.get(i), getNormalAttributes()));
} else {
- result.add(new LineExtensionInfo(actualParts.get(i), getChangedForeground(), null, null, Font.ITALIC));
+ result.add(new LineExtensionInfo(actualParts.get(i), getChangedAttributes()));
}
if (i != actualParts.size() - 1) {
- result.add(new LineExtensionInfo(", ", getForeground(), null, null, Font.ITALIC));
+ result.add(new LineExtensionInfo(", ", getNormalAttributes()));
}
}
- result.add(new LineExtensionInfo("}", getForeground(), null, null, Font.ITALIC));
+ result.add(new LineExtensionInfo("}", getNormalAttributes()));
return;
}
- result.add(new LineExtensionInfo(actual, getChangedForeground(), null, null, Font.ITALIC));
+ result.add(new LineExtensionInfo(actual, getChangedAttributes()));
}
private static boolean isArray(String s) {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java
index 6314a6b9f97b..143e95fbc16b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -54,6 +54,9 @@ public class DebuggerColorsPage implements ColorSettingsPage, DisplayPrioritySor
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.breakpoint.line"), DebuggerColors.BREAKPOINT_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.execution.point"), DebuggerColors.EXECUTIONPOINT_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.not.top.frame"), DebuggerColors.NOT_TOP_FRAME_ATTRIBUTES),
+ new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.inlined.values"), DebuggerColors.INLINED_VALUES),
+ new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.inlined.values.modified"), DebuggerColors.INLINED_VALUES_MODIFIED),
+ new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.inlined.values.execution.line"), DebuggerColors.INLINED_VALUES_EXECUTION_LINE),
};
}
diff --git a/plugins/devkit/src/util/ChooseModulesDialog.java b/plugins/devkit/src/util/ChooseModulesDialog.java
index 34b62d26ea10..e77a6292d73d 100644
--- a/plugins/devkit/src/util/ChooseModulesDialog.java
+++ b/plugins/devkit/src/util/ChooseModulesDialog.java
@@ -99,7 +99,7 @@ public class ChooseModulesDialog extends DialogWrapper {
myView.setShowGrid(false);
myView.setTableHeader(null);
- myView.setIntercellSpacing(new Dimension(0, 0));
+ myView.setIntercellSpacing(JBUI.emptySize());
TableUtil.setupCheckboxColumn(myView, 0);
myView.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/Generator.java b/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/Generator.java
index 72f278390514..771a10dec6e9 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/Generator.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/wizard/Generator.java
@@ -572,14 +572,7 @@ public final class Generator {
@SuppressWarnings({"HardCodedStringLiteral"})
private static String suggestGetterName(final String propertyName, final String propertyType) {
- final StringBuffer name = new StringBuffer(StringUtil.capitalize(propertyName));
- if ("boolean".equals(propertyType)) {
- name.insert(0, "is");
- }
- else {
- name.insert(0, "get");
- }
- return name.toString();
+ return PropertyUtil.suggestGetterName(propertyName, "boolean".equals(propertyType) ? PsiType.BOOLEAN : null);
}
public static void prepareWizardData(final WizardData data, PsiClass boundClass) throws MyException {
diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java
index f0a81efaacdf..4a76a487de6d 100644
--- a/python/src/com/jetbrains/python/formatter/PyBlock.java
+++ b/python/src/com/jetbrains/python/formatter/PyBlock.java
@@ -243,12 +243,13 @@ public class PyBlock implements ASTBlock {
}
}
//Align elements vertically if there is an argument in the first line of parenthesized expression
- else if (((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION && myContext.getSettings().ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION)
- || (parentType == PyElementTypes.ARGUMENT_LIST && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS)
- || (parentType == PyElementTypes.PARAMETER_LIST && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS)) &&
+ else if (!hasHangingIndent(_node.getPsi()) &&
+ ((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION && myContext.getSettings().ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION) ||
+ (parentType == PyElementTypes.ARGUMENT_LIST && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS) ||
+ (parentType == PyElementTypes.PARAMETER_LIST && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS)) &&
!isIndentNext(child) &&
- !hasLineBreaksBefore(_node.getFirstChildNode(), 1)
- && !ourListElementTypes.contains(childType)) {
+ !hasLineBreaksBefore(_node.getFirstChildNode(), 1) &&
+ !ourListElementTypes.contains(childType)) {
if (!ourBrackets.contains(childType)) {
childAlignment = getAlignmentForChildren();
@@ -325,6 +326,49 @@ public class PyBlock implements ASTBlock {
return new PyBlock(this, child, childAlignment, childIndent, wrap, myContext);
}
+ // Check https://www.python.org/dev/peps/pep-0008/#indentation
+ private boolean hasHangingIndent(@NotNull PsiElement elem) {
+ final PsiElement[] items;
+ if (elem instanceof PyCallExpression) {
+ final PyArgumentList argumentList = ((PyCallExpression)elem).getArgumentList();
+ return argumentList != null && hasHangingIndent(argumentList);
+ }
+ else if (elem instanceof PyFunction) {
+ return hasHangingIndent(((PyFunction)elem).getParameterList());
+ }
+
+ final PsiElement firstChild = elem.getFirstChild();
+ if (firstChild == null) {
+ return false;
+ }
+ if (PyTokenTypes.OPEN_BRACES.contains(firstChild.getNode().getElementType()) && hasLineBreaksAfter(firstChild.getNode(), 1)) {
+ return true;
+ }
+
+ if (elem instanceof PySequenceExpression) {
+ items = ((PySequenceExpression)elem).getElements();
+ }
+ else if (elem instanceof PyParameterList) {
+ items = ((PyParameterList)elem).getParameters();
+ }
+ else if (elem instanceof PyArgumentList) {
+ items = ((PyArgumentList)elem).getArguments();
+ }
+ else if (elem instanceof PyParenthesizedExpression) {
+ final PyParenthesizedExpression parenthesizedExpr = (PyParenthesizedExpression)elem;
+ if (parenthesizedExpr.getContainedExpression() instanceof PyTupleExpression) {
+ items = (((PyTupleExpression)parenthesizedExpr.getContainedExpression()).getElements());
+ }
+ else {
+ items = new PsiElement[]{parenthesizedExpr.getContainedExpression()};
+ }
+ }
+ else {
+ return false;
+ }
+ return items.length == 0 || hasHangingIndent(items[0]);
+ }
+
private static boolean breaksAlignment(IElementType type) {
return type != PyElementTypes.BINARY_EXPRESSION;
}
@@ -409,10 +453,10 @@ public class PyBlock implements ASTBlock {
myContext.getMode() == FormattingMode.ADJUST_INDENT) {
return true;
}
- return false;
+ return !hasHangingIndent(_node.getPsi());
}
if (_node.getElementType() == PyElementTypes.ARGUMENT_LIST) {
- if (!myContext.getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS) {
+ if (!myContext.getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS || hasHangingIndent(_node.getPsi())) {
return false;
}
if (child.getElementType() == PyTokenTypes.COMMA) {
@@ -427,7 +471,7 @@ public class PyBlock implements ASTBlock {
return false;
}
if (_node.getElementType() == PyElementTypes.PARAMETER_LIST) {
- return myContext.getSettings().ALIGN_MULTILINE_PARAMETERS;
+ return !hasHangingIndent(_node.getPsi()) && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS;
}
if (_node.getElementType() == PyElementTypes.SUBSCRIPTION_EXPRESSION) {
return false;
@@ -447,12 +491,18 @@ public class PyBlock implements ASTBlock {
return node;
}
- private static boolean hasLineBreaksBefore(ASTNode child, int minCount) {
+ private static boolean hasLineBreaksBefore(@NotNull ASTNode child, int minCount) {
final ASTNode treePrev = child.getTreePrev();
return (treePrev != null && isWhitespaceWithLineBreaks(TreeUtil.findLastLeaf(treePrev), minCount)) ||
isWhitespaceWithLineBreaks(child.getFirstChildNode(), minCount);
}
+ private static boolean hasLineBreaksAfter(@NotNull ASTNode child, int minCount) {
+ final ASTNode treeNext = child.getTreeNext();
+ return (treeNext != null && isWhitespaceWithLineBreaks(TreeUtil.findLastLeaf(treeNext), minCount)) ||
+ isWhitespaceWithLineBreaks(child.getLastChildNode(), minCount);
+ }
+
private static boolean isWhitespaceWithLineBreaks(ASTNode node, int minCount) {
if (node != null && node.getElementType() == TokenType.WHITE_SPACE) {
String prevNodeText = node.getText();
diff --git a/python/src/com/jetbrains/python/formatter/PythonFormattingModelBuilder.java b/python/src/com/jetbrains/python/formatter/PythonFormattingModelBuilder.java
index 595213c7b833..c468290a8514 100644
--- a/python/src/com/jetbrains/python/formatter/PythonFormattingModelBuilder.java
+++ b/python/src/com/jetbrains/python/formatter/PythonFormattingModelBuilder.java
@@ -113,6 +113,7 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
.withinPairInside(LPAR, RPAR, PARAMETER_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_PARENTHESES)
.withinPairInside(LPAR, RPAR, FROM_IMPORT_STATEMENT).spaces(0)
.withinPairInside(LPAR, RPAR, GENERATOR_EXPRESSION).spaces(0)
+ .withinPairInside(LPAR, RPAR, PARENTHESIZED_EXPRESSION).spaces(0)
.before(LBRACKET).spaceIf(pySettings.SPACE_BEFORE_LBRACKET)
.withinPair(LBRACE, RBRACE).spaceIf(pySettings.SPACE_WITHIN_BRACES)
diff --git a/python/testData/formatter/alignInParenthesizedExpression_after.py b/python/testData/formatter/alignInParenthesizedExpression_after.py
index 868557ca748f..9e619c4e8013 100644
--- a/python/testData/formatter/alignInParenthesizedExpression_after.py
+++ b/python/testData/formatter/alignInParenthesizedExpression_after.py
@@ -5,4 +5,4 @@ print(1 + (1 + (1
+
x.
calc()
-))
\ No newline at end of file
+ ))
\ No newline at end of file
diff --git a/python/testData/formatter/alignmentOfClosingBraceInDictLiteralWhenNoHangingIndent.py b/python/testData/formatter/alignmentOfClosingBraceInDictLiteralWhenNoHangingIndent.py
new file mode 100644
index 000000000000..af427d022905
--- /dev/null
+++ b/python/testData/formatter/alignmentOfClosingBraceInDictLiteralWhenNoHangingIndent.py
@@ -0,0 +1,8 @@
+class Checkpoints(webapp2.RequestHandler):
+ def get(self):
+ self.response.write(json.dumps({"meta": {"code": 400,
+ "errorType": "paramError",
+ "errorDetail": "Parameter 'api_key' is missing"
+ },
+ "response": {}
+ }))
\ No newline at end of file
diff --git a/python/testData/formatter/alignmentOfClosingBraceInDictLiteralWhenNoHangingIndent_after.py b/python/testData/formatter/alignmentOfClosingBraceInDictLiteralWhenNoHangingIndent_after.py
new file mode 100644
index 000000000000..d7df54a76338
--- /dev/null
+++ b/python/testData/formatter/alignmentOfClosingBraceInDictLiteralWhenNoHangingIndent_after.py
@@ -0,0 +1,8 @@
+class Checkpoints(webapp2.RequestHandler):
+ def get(self):
+ self.response.write(json.dumps({"meta": {"code": 400,
+ "errorType": "paramError",
+ "errorDetail": "Parameter 'api_key' is missing"
+ },
+ "response": {}
+ }))
\ No newline at end of file
diff --git a/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCall.py b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCall.py
new file mode 100644
index 000000000000..107888673836
--- /dev/null
+++ b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCall.py
@@ -0,0 +1,10 @@
+def test_function(*args):
+ pass
+
+test_function({
+ 'a': 'b',
+}, 5)
+
+test_function(1,
+ 2,
+ 3)
\ No newline at end of file
diff --git a/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCallOnTyping.py b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCallOnTyping.py
new file mode 100644
index 000000000000..5132384a86b5
--- /dev/null
+++ b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCallOnTyping.py
@@ -0,0 +1,3 @@
+handler = webapp2.WSGIApplication([
+ ('/', UserHandler),
+], debug=True)
diff --git a/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCallOnTyping_after.py b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCallOnTyping_after.py
new file mode 100644
index 000000000000..9e3811c7a380
--- /dev/null
+++ b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCallOnTyping_after.py
@@ -0,0 +1,4 @@
+handler = webapp2.WSGIApplication([
+ ('/', UserHandler),
+ ()
+], debug=True)
diff --git a/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCall_after.py b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCall_after.py
new file mode 100644
index 000000000000..f8fbb2f5c06b
--- /dev/null
+++ b/python/testData/formatter/noAlignmentAfterDictHangingIndentInFunctionCall_after.py
@@ -0,0 +1,11 @@
+def test_function(*args):
+ pass
+
+
+test_function({
+ 'a': 'b',
+}, 5)
+
+test_function(1,
+ 2,
+ 3)
\ No newline at end of file
diff --git a/python/testData/formatter/spacesInsideParenthesisAreStripped.py b/python/testData/formatter/spacesInsideParenthesisAreStripped.py
new file mode 100644
index 000000000000..e8998d6360a0
--- /dev/null
+++ b/python/testData/formatter/spacesInsideParenthesisAreStripped.py
@@ -0,0 +1,4 @@
+def crap( self ):
+ foo = ( 'bar' for bar in [ 1, 2,3,4 ] )
+ if ( 'a' and 'b' ):
+ blah( '123' )
\ No newline at end of file
diff --git a/python/testData/formatter/spacesInsideParenthesisAreStripped_after.py b/python/testData/formatter/spacesInsideParenthesisAreStripped_after.py
new file mode 100644
index 000000000000..56282e7d9b5a
--- /dev/null
+++ b/python/testData/formatter/spacesInsideParenthesisAreStripped_after.py
@@ -0,0 +1,4 @@
+def crap(self):
+ foo = ('bar' for bar in [1, 2, 3, 4])
+ if ('a' and 'b'):
+ blah('123')
\ No newline at end of file
diff --git a/python/testData/formatter/tupleInArgList_after.py b/python/testData/formatter/tupleInArgList_after.py
index ff31f6bd51cc..72dce723faab 100644
--- a/python/testData/formatter/tupleInArgList_after.py
+++ b/python/testData/formatter/tupleInArgList_after.py
@@ -1,4 +1,4 @@
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
-)
+ )
diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java
index 4c6e3fd22e7a..96e2c7e86ee7 100644
--- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java
+++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.formatter.PyCodeStyleSettings;
@@ -159,7 +160,7 @@ public class PyFormatterTest extends PyTestCase {
}
public void testNoAlignForMethodArguments() { // PY-3995
- settings().getCommonSettings(PythonLanguage.getInstance()).ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
+ getCommonSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
doTest();
}
@@ -430,6 +431,46 @@ public class PyFormatterTest extends PyTestCase {
myFixture.checkResultByFile("formatter/" + getTestName(true) + "_after.py");
}
+ // PY-12861
+ public void testSpacesInsideParenthesisAreStripped() {
+ doTest();
+ }
+
+ // PY-14838
+ public void testNoAlignmentAfterDictHangingIndentInFunctionCall() {
+ getCommonSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+ try {
+ doTest();
+ }
+ finally {
+ settings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
+ }
+ }
+
+ // PY-13955
+ public void testNoAlignmentAfterDictHangingIndentInFunctionCallOnTyping() {
+ settings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+ try {
+ final String testName = "formatter/" + getTestName(true);
+ myFixture.configureByFile(testName + ".py");
+ WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+ @Override
+ public void run() {
+ myFixture.type("\n(");
+ }
+ });
+ myFixture.checkResultByFile(testName + "_after.py");
+ }
+ finally {
+ settings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
+ }
+ }
+
+ // PY-12145
+ public void testAlignmentOfClosingBraceInDictLiteralWhenNoHangingIndent() {
+ doTest();
+ }
+
/**
* This test merely checks that call to {@link com.intellij.psi.codeStyle.CodeStyleManager#reformat(com.intellij.psi.PsiElement)}
* is possible for Python sources.
@@ -450,7 +491,11 @@ public class PyFormatterTest extends PyTestCase {
myFixture.checkResultByFile("formatter/" + getTestName(true) + "_after.py");
}
+ private CommonCodeStyleSettings getCommonSettings() {
+ return settings().getCommonSettings(PythonLanguage.getInstance());
+ }
+
private CodeStyleSettings settings() {
- return CodeStyleSettingsManager.getInstance().getSettings(myFixture.getProject());
+ return CodeStyleSettingsManager.getSettings(myFixture.getProject());
}
}