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 @@ + + +