From b66623a183d3764b10059003bef8257b24cbe029 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 29 May 2014 19:23:13 +0400 Subject: [PATCH 01/25] do not fail position manager if assert happened in one of the providers --- .../debugger/engine/CompoundPositionManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java index c890d1459cf8..127765ae9b1b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java @@ -63,6 +63,9 @@ public class CompoundPositionManager extends PositionManagerEx { catch (Exception e) { LOG.error(e); } + catch (AssertionError e) { + LOG.error(e); + } } return null; } @@ -79,6 +82,9 @@ public class CompoundPositionManager extends PositionManagerEx { catch (Exception e) { LOG.error(e); } + catch (AssertionError e) { + LOG.error(e); + } } return Collections.emptyList(); } @@ -95,6 +101,9 @@ public class CompoundPositionManager extends PositionManagerEx { catch (Exception e) { LOG.error(e); } + catch (AssertionError e) { + LOG.error(e); + } } return Collections.emptyList(); } @@ -110,6 +119,9 @@ public class CompoundPositionManager extends PositionManagerEx { catch (Exception e) { LOG.error(e); } + catch (AssertionError e) { + LOG.error(e); + } } return null; From 3a8647fa3948dc09db4d53f6b7a8bd1b57839bb2 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 29 May 2014 19:55:22 +0400 Subject: [PATCH 02/25] reverted changes blocking inner classes in libraries to work --- .../intellij/debugger/engine/PositionManagerImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java index 2da1246e11b6..0e37ff354e47 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java @@ -177,7 +177,16 @@ public class PositionManagerImpl implements PositionManager { return null; } - PsiClass psiClass = DebuggerUtils.findClass(refType.name(), project, myDebugProcess.getSearchScope()); + final String originalQName = refType.name(); + final GlobalSearchScope searchScope = myDebugProcess.getSearchScope(); + PsiClass psiClass = DebuggerUtils.findClass(originalQName, project, searchScope); // try to lookup original name first + if (psiClass == null) { + int dollar = originalQName.indexOf('$'); + if (dollar > 0) { + final String qName = originalQName.substring(0, dollar); + psiClass = DebuggerUtils.findClass(qName, project, searchScope); + } + } if (psiClass != null) { final PsiElement element = psiClass.getNavigationElement(); From 73bfc963c0bfb21da818fd2d216b66dbe1143885 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 29 May 2014 19:48:57 +0400 Subject: [PATCH 03/25] NPE --- java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java | 4 ++-- .../swingBuilder/SwingBuilderNamedArgumentProvider.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java index c5e084d7f2f7..1a7e71c5fc69 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -117,7 +117,7 @@ public class PsiTypesUtil { } @Nullable - public static PsiClass getPsiClass(final PsiType psiType) { + public static PsiClass getPsiClass(@Nullable PsiType psiType) { return psiType instanceof PsiClassType? ((PsiClassType)psiType).resolve() : null; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java index 2701921d19cf..e1828855af0d 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java @@ -42,7 +42,7 @@ public class SwingBuilderNamedArgumentProvider extends GroovyNamedArgumentProvid @Nullable String argumentName, boolean forCompletion, Map result) { - PsiType returnType = ((PsiMethod)resolve).getReturnType(); + PsiType returnType = resolve == null ? null : ((PsiMethod)resolve).getReturnType(); PsiClass aClass = PsiTypesUtil.getPsiClass(returnType); if (aClass == null) return; From 2f3db6ab8a6907893e2ee3a9bba1354672b44816 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 29 May 2014 19:51:57 +0400 Subject: [PATCH 04/25] UOE --- .../org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java index 6d19188c3a3b..ae0b7566fe34 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java @@ -318,12 +318,12 @@ public class GroovyDslFileIndex extends ScalarIndexExtension { return; } - Set classes = ContainerUtil.map2Set(extensions, new Function() { + Set classes = new HashSet(ContainerUtil.map2Set(extensions, new Function() { @Override public Class fun(GroovyFrameworkConfigNotification notification) { return notification.getClass(); } - }); + })); classes.add(GroovyFrameworkConfigNotification.class); // for default extension // perhaps a separate extension for that? From ba6e884d5d152d658a264f84ce610c82c6829235 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 29 May 2014 20:13:19 +0400 Subject: [PATCH 05/25] initialize file types --- .../src/org/jetbrains/plugins/groovy/GroovyFileType.java | 2 ++ .../org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java | 3 ++- .../src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java index 6abff46ddc16..fe48f06b2d68 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java @@ -55,8 +55,10 @@ public class GroovyFileType extends LanguageFileType { return new GroovyEditorHighlighter(colors); } }); + GROOVY_FILE_TYPES.add(GROOVY_FILE_TYPE); } + @NotNull public static FileType[] getGroovyEnabledFileTypes() { return GROOVY_FILE_TYPES.toArray(new FileType[GROOVY_FILE_TYPES.size()]); } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java index a339c3ac422b..3e5a91b80125 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java @@ -704,7 +704,8 @@ public class PsiUtil { return nextSibling; } - public static PsiIdentifier getJavaNameIdentifier(GrNamedElement namedElement) { + @NotNull + public static PsiIdentifier getJavaNameIdentifier(@NotNull GrNamedElement namedElement) { final PsiElement element = namedElement.getNameIdentifierGroovy(); JavaIdentifier identifier = element.getUserData(NAME_IDENTIFIER); if (identifier == null) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java index b5a4e9af627a..734cae7b3470 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java @@ -50,6 +50,5 @@ public class GroovyFileTypeLoader extends FileTypeFactory{ @Override public void createFileTypes(@NotNull FileTypeConsumer consumer) { consumer.consume(GroovyFileType.GROOVY_FILE_TYPE, StringUtil.join(getAllGroovyExtensions(), ";")); - GroovyFileType.GROOVY_FILE_TYPES.add(GroovyFileType.GROOVY_FILE_TYPE); } } From 2f4d4fbb0f8f6cf2fd20d5887a05c71a45f38e79 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 29 May 2014 20:40:39 +0400 Subject: [PATCH 06/25] register container provider --- .../com/intellij/core/JavaCoreApplicationEnvironment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java b/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java index 902322272ea8..b71bdefee9be 100644 --- a/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java +++ b/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java @@ -15,6 +15,8 @@ */ package com.intellij.core; +import com.intellij.codeInsight.ContainerProvider; +import com.intellij.codeInsight.JavaContainerProvider; import com.intellij.codeInsight.folding.JavaCodeFoldingSettings; import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsBase; import com.intellij.codeInsight.folding.impl.JavaFoldingBuilderBase; @@ -75,6 +77,9 @@ public class JavaCoreApplicationEnvironment extends CoreApplicationEnvironment { registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class); registerExtensionPoint(Extensions.getRootArea(), JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class); + registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME, ContainerProvider.class); + addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider()); + myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper()); myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl()); From 032faad9776c28d63fdaa6daaf27e0acd7195225 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 29 May 2014 20:41:17 +0400 Subject: [PATCH 07/25] EIAE --- .../src/org/jetbrains/plugins/groovy/GroovyFileType.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java index fe48f06b2d68..96946afacd1c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java @@ -40,10 +40,9 @@ import java.util.List; * @author ilyas */ public class GroovyFileType extends LanguageFileType { - + public static final List GROOVY_FILE_TYPES = new ArrayList(); public static final GroovyFileType GROOVY_FILE_TYPE = new GroovyFileType(); @NonNls public static final String DEFAULT_EXTENSION = "groovy"; - public static final List GROOVY_FILE_TYPES = new ArrayList(); private GroovyFileType() { super(GroovyLanguage.INSTANCE); @@ -55,7 +54,7 @@ public class GroovyFileType extends LanguageFileType { return new GroovyEditorHighlighter(colors); } }); - GROOVY_FILE_TYPES.add(GROOVY_FILE_TYPE); + GROOVY_FILE_TYPES.add(this); } @NotNull From 41b974e36fdb731ceaeb52a73394a43b468761e6 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 29 May 2014 19:53:12 +0400 Subject: [PATCH 08/25] anonym -> lambda: disable if target SAM type is raw and methods are called on params with Object erasure (IDEA-125613) --- .../AnonymousCanBeLambdaInspection.java | 61 +++++++++++++++++++ .../quickFix/anonymous2lambda/beforeRaw.java | 24 ++++++++ 2 files changed, 85 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java index 96bb18a99158..87ad7d9f6756 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java @@ -30,9 +30,13 @@ import com.intellij.psi.codeStyle.JavaCodeStyleManager; import com.intellij.psi.controlFlow.AnalysisCanceledException; import com.intellij.psi.controlFlow.ControlFlow; import com.intellij.psi.controlFlow.ControlFlowUtil; +import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy; +import com.intellij.psi.infos.MethodCandidateInfo; import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.psi.util.PsiTypesUtil; import com.intellij.psi.util.PsiUtil; +import com.intellij.util.ArrayUtilRt; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.util.containers.hash.LinkedHashMap; @@ -106,6 +110,43 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection }; } + private static PsiType getInferredType(PsiAnonymousClass aClass) { + final PsiExpression expression = (PsiExpression)aClass.getParent(); + final PsiType psiType = PsiTypesUtil.getExpectedTypeByParent(expression); + if (psiType != null) { + return psiType; + } + + PsiExpression topExpr = expression; + while (topExpr.getParent() instanceof PsiParenthesizedExpression) { + topExpr = (PsiExpression)topExpr.getParent(); + } + + final PsiElement parent = topExpr.getParent(); + if (parent instanceof PsiExpressionList) { + PsiExpressionList expressionList = (PsiExpressionList)parent; + final PsiElement callExpr = expressionList.getParent(); + if (callExpr instanceof PsiCallExpression) { + final JavaResolveResult result = ((PsiCallExpression)callExpr).resolveMethodGenerics(); + if (result instanceof MethodCandidateInfo) { + final PsiMethod method = ((MethodCandidateInfo)result).getElement(); + PsiExpression[] expressions = expressionList.getExpressions(); + int i = ArrayUtilRt.find(expressions, topExpr); + if (i < 0) return null; + expressions[i] = null; + + final PsiParameter[] parameters = method.getParameterList().getParameters(); + final PsiSubstitutor substitutor = PsiResolveHelper.SERVICE.getInstance(aClass.getProject()) + .inferTypeArguments(method.getTypeParameters(), parameters, expressions, + ((MethodCandidateInfo)result).getSiteSubstitutor(), callExpr.getParent(), + DefaultParameterTypeInferencePolicy.INSTANCE); + return substitutor.substitute(parameters[i].getType()); + } + } + } + return null; + } + private static class ReplaceWithLambdaFix implements LocalQuickFix, HighPriorityAction { @NotNull @Override @@ -328,10 +369,14 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection private final PsiMethod myMethod; private final PsiAnonymousClass myAnonymClass; + private final boolean myRawType; + public ForbiddenRefsChecker(PsiMethod method, PsiAnonymousClass aClass) { myMethod = method; myAnonymClass = aClass; + final PsiType inferredType = getInferredType(aClass); + myRawType = inferredType instanceof PsiClassType && ((PsiClassType)inferredType).isRaw(); } @Override @@ -390,6 +435,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection if (initializer == null || initializer.getTextOffset() > myAnonymClass.getTextOffset() && !((PsiField)resolved).hasModifierProperty(PsiModifier.STATIC)) { myBodyContainsForbiddenRefs = true; + return; } } } else { @@ -407,16 +453,31 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection final Collection writtenVariables = ControlFlowUtil.getWrittenVariables(flow, 0, startOffset, false); if (!writtenVariables.contains(resolved)) { myBodyContainsForbiddenRefs = true; + return; } } } catch (AnalysisCanceledException e) { myBodyContainsForbiddenRefs = true; + return; } } } } } + + if (myRawType) { + final PsiElement resolved = expression.resolve(); + if (resolved instanceof PsiParameter && ((PsiParameter)resolved).getDeclarationScope() == myMethod) { + final int parameterIndex = myMethod.getParameterList().getParameterIndex((PsiParameter)resolved); + for (PsiMethod superMethod : myMethod.findDeepestSuperMethods()) { + if (PsiUtil.resolveClassInType(superMethod.getParameterList().getParameters()[parameterIndex].getType()) instanceof PsiTypeParameter) { + myBodyContainsForbiddenRefs = true; + return; + } + } + } + } } public boolean hasForbiddenRefs() { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java new file mode 100644 index 000000000000..e9389d73da1b --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java @@ -0,0 +1,24 @@ +// "Replace with lambda" "false" +class DbTableBinder { + + public Binder build() { + return new Binder() { + public void bind(A q, DbTable dbTable) { + q.bind("name", dbTable.name); + } + }; + } +} + +class DbTable { + String name; +} + +interface Binder { + void bind(A sqlStatement, ArgType argType); +} + +interface A

{ + void bind(String s, String p); +} + From 495500957b3cdf84a6141128700754a861e230e1 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 28 May 2014 12:56:47 +0200 Subject: [PATCH 09/25] remove mostly non-useful Integer.valueOf completion suggestions --- .../intellij/psi/filters/getters/MembersGetter.java | 10 ++++++++-- .../completion/normalSorting/NoNumberValueOf.java | 7 +++++++ .../completion/NormalCompletionOrderingTest.groovy | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java diff --git a/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java b/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java index 9e13bdc576de..14f4e7e67731 100644 --- a/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java +++ b/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java @@ -90,11 +90,11 @@ public abstract class MembersGetter { public void processMembers(final Consumer results, @Nullable final PsiClass where, final boolean acceptMethods, final boolean searchInheritors) { - if (where == null || CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName())) return; + if (where == null || isPrimitiveClass(where)) return; final boolean searchFactoryMethods = searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) && - !CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName()); + !isPrimitiveClass(where); final Project project = myPlace.getProject(); final GlobalSearchScope scope = myPlace.getResolveScope(); @@ -127,6 +127,12 @@ public abstract class MembersGetter { } } + private static boolean isPrimitiveClass(PsiClass where) { + String qname = where.getQualifiedName(); + if (qname == null || !qname.startsWith("java.lang.")) return false; + return CommonClassNames.JAVA_LANG_STRING.equals(qname) || InheritanceUtil.isInheritor(where, CommonClassNames.JAVA_LANG_NUMBER); + } + private void doProcessMembers(boolean acceptMethods, Consumer results, boolean isExpectedTypeMember, Collection declarations) { diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java b/java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java new file mode 100644 index 000000000000..d53e3c294eb5 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java @@ -0,0 +1,7 @@ +public class Foo { + + void foo(Object value) { + Integer i = valx + } +} + diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy index 7f94ec458922..7824a64596ef 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy @@ -625,6 +625,10 @@ interface TxANotAnno {} checkPreferredItems 0, 'XException', 'XClass', 'XIntf' } + public void testNoNumberValueOf() { + checkPreferredItems 0, 'value' + } + public void testGlobalStaticMemberStats() { configureNoCompletion(getTestName(false) + ".java") myFixture.complete(CompletionType.BASIC, 2) From 31be027def890389058c488466b1347ca4dc8a7f Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 28 May 2014 14:22:51 +0200 Subject: [PATCH 10/25] relax time in MessageBusTest.testPostingPerformanceWithLowListenerDensityInHierarchy --- .../testSrc/com/intellij/util/messages/MessageBusTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java b/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java index d0b5829dccca..5a72ecc1ea41 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java @@ -215,7 +215,7 @@ public class MessageBusTest extends TestCase { new MessageBusImpl(this, childBus); } - PlatformTestUtil.assertTiming("Too long", 2500, new Runnable() { + PlatformTestUtil.assertTiming("Too long", 3000, new Runnable() { @Override public void run() { T1Listener publisher = myBus.syncPublisher(TOPIC1); From 9c29b9548ae8cea508fe015082609f80ba8faa0e Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 29 May 2014 20:45:33 +0200 Subject: [PATCH 11/25] fix dfa contract IOOBE with varargs --- .../codeInspection/dataFlow/StandardInstructionVisitor.java | 2 +- .../testData/inspection/dataFlow/fixture/ContractVarargs.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java index 81944764f45f..8c9c635ada33 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java @@ -207,7 +207,7 @@ public class StandardInstructionVisitor extends InstructionVisitor { for (int i = 0; i < args.length; i++) { final DfaValue arg = memState.pop(); int paramIndex = args.length - i - 1; - if (argValues != null && (paramIndex < args.length - 1 || !varargCall)) { + if (argValues != null && (paramIndex < argValues.length - 1 || !varargCall)) { argValues[paramIndex] = arg; } diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java index e65bc8740e83..d8f144af2b41 100644 --- a/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java +++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java @@ -32,6 +32,10 @@ class Contracts { notBlank(message, "Message should not be blank", new Object(), new Object()); log(message); } + public void vararg3(@Nullable String message) { + notBlank(message, "Message should not be blank", new Object(), new Object(), new Object(), new Object(), new Object()); + log(message); + } public void log(@NotNull String message) { System.out.println(message); From a30a74e846b4243ed272d2608d3acf0693ce8f3f Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 29 May 2014 21:10:14 +0200 Subject: [PATCH 12/25] fix dfa contract believing that nullable is always null --- .../dataFlow/StandardInstructionVisitor.java | 7 +++++-- .../fixture/ContractInapplicableComparison.java | 16 ++++++++++++++++ .../codeInspection/DataFlowInspectionTest.java | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java index 8c9c635ada33..e66ce1831927 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java @@ -245,7 +245,6 @@ public class StandardInstructionVisitor extends InstructionVisitor { DfaConstValue.Factory constFactory = factory.getConstFactory(); List falseStates = ContainerUtil.newArrayList(); for (int i = 0; i < argValues.length; i++) { - List nextStates = ContainerUtil.newArrayList(); DfaValue argValue = argValues[i]; MethodContract.ValueConstraint constraint = contract.arguments[i]; DfaConstValue expectedValue = constraint == NULL_VALUE || constraint == NOT_NULL_VALUE ? constFactory.getNull() : @@ -257,10 +256,14 @@ public class StandardInstructionVisitor extends InstructionVisitor { boolean invertCondition = constraint == NOT_NULL_VALUE; DfaValue condition = factory.getRelationFactory().createRelation(argValue, expectedValue, EQEQ, invertCondition); if (condition == null) { - if (!(argValue instanceof DfaConstValue)) continue; + if (!(argValue instanceof DfaConstValue)) { + falseStates.addAll(states); + continue; + } condition = constFactory.createFromValue(argValue == expectedValue, PsiType.BOOLEAN, null); } + List nextStates = ContainerUtil.newArrayList(); for (DfaMemoryState state : states) { boolean unknownVsNull = expectedValue == constFactory.getNull() && argValue instanceof DfaVariableValue && diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java new file mode 100644 index 000000000000..92a63013e3c2 --- /dev/null +++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java @@ -0,0 +1,16 @@ +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.Nullable; + +class Foo { + void foo() { + Object o1 = bar(goo()); + if (o1 == null) { + System.out.println(); + } + } + + @Nullable Object goo() { return null;} + + @Nullable @Contract("null->null") static Object bar(@Nullable Object foo) { return foo; } + +} diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index af0f2a7bc2cf..67987b3ab8eb 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -207,6 +207,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { } public void testContractAnnotation() { doTest(); } + public void testContractInapplicableComparison() { doTest(); } public void testContractInLoopNotTooComplex() { doTest(); } public void testContractWithNullable() { doTest(); } public void testContractWithNotNull() { doTest(); } From b57a8cafdc1a8e292f364b3514137e6351508006 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 29 May 2014 21:57:17 +0200 Subject: [PATCH 13/25] get python language level from the root model when pushers haven't finished yet --- python/src/com/jetbrains/python/psi/PyUtil.java | 4 +++- .../python/psi/impl/PythonLanguageLevelPusher.java | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java index 3ec28a21d64a..877da8df6dd9 100644 --- a/python/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/src/com/jetbrains/python/psi/PyUtil.java @@ -67,6 +67,7 @@ import com.jetbrains.python.codeInsight.stdlib.PyNamedTupleType; import com.jetbrains.python.magicLiteral.PyMagicLiteralTools; import com.jetbrains.python.psi.impl.PyBuiltinCache; import com.jetbrains.python.psi.impl.PyPsiUtils; +import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher; import com.jetbrains.python.psi.types.*; import com.jetbrains.python.refactoring.classes.PyDependenciesComparator; import com.jetbrains.python.refactoring.classes.extractSuperclass.PyExtractSuperclassHelper; @@ -775,7 +776,8 @@ public class PyUtil { // Most of the cases should be handled by this one, PyLanguageLevelPusher pushes folders only final VirtualFile folder = virtualFile.getParent(); if (folder != null) { - final LanguageLevel level = folder.getUserData(LanguageLevel.KEY); + LanguageLevel level = folder.getUserData(LanguageLevel.KEY); + if (level == null) level = PythonLanguageLevelPusher.getFileLanguageLevel(project, virtualFile); if (level != null) return level; } else { diff --git a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java index 132e6570b8fa..c3fd23bc289c 100644 --- a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java +++ b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java @@ -20,7 +20,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.module.ModuleUtil; +import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.*; @@ -85,14 +85,19 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher Date: Fri, 30 May 2014 01:07:01 +0400 Subject: [PATCH 14/25] ad text in 'go to' actions --- .../com/intellij/ide/actions/GotoActionBase.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java index 8764cec20dbd..c109de7a00a9 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java @@ -27,6 +27,7 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; +import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; @@ -44,6 +45,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.event.DocumentEvent; import java.awt.*; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import java.util.List; import java.util.Map; @@ -207,6 +210,13 @@ public abstract class GotoActionBase extends AnAction { popup.setFindUsagesTitle(findUsagesTitle); final ChooseByNameFilter filter = callback.createFilter(popup); + if (historyEnabled() && popup.getAdText() == null) { + popup.setAdText("Press " + + KeymapUtil.getKeystrokeText(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK)) + " or " + + KeymapUtil.getKeystrokeText(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK)) + + " to navigate through the history"); + } + popup.invoke(new ChooseByNamePopupComponent.Callback() { @Override public void onClose() { @@ -251,7 +261,7 @@ public abstract class GotoActionBase extends AnAction { abstract class HistoryAction extends DumbAwareAction { @Override public void update(AnActionEvent e) { - e.getPresentation().setEnabled(!ContainerUtil.isEmpty(ourHistory.get(myInAction))); + e.getPresentation().setEnabled(historyEnabled()); } void setText(@NotNull List strings) { @@ -284,4 +294,8 @@ public abstract class GotoActionBase extends AnAction { } }.registerCustomShortcutSet(CustomShortcutSet.fromString("ctrl DOWN"), editor); } + + private static boolean historyEnabled() { + return !ContainerUtil.isEmpty(ourHistory.get(myInAction)); + } } From fbb0f3913970e8c3b82b038fee2e2563fbda7334 Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 30 May 2014 09:15:22 +0400 Subject: [PATCH 15/25] jasper validation tests: fixes and cleanup --- .../compiler/CompilerManagerImpl.java | 43 ------------------- .../compiler/BaseCompilerTestCase.java | 31 +------------ .../testFramework/CompilerTester.java | 2 - .../compiler/MavenCompilingTestCase.java | 2 - 4 files changed, 2 insertions(+), 76 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java index 14158f178d35..5cb7a2477315 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java @@ -30,7 +30,6 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.ArrayUtil; import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; import org.jetbrains.annotations.NotNull; @@ -246,48 +245,6 @@ public class CompilerManagerImpl extends CompilerManager { } } - // Compiler tests support - - private static List ourDeletedPaths; - private static List ourRecompiledPaths; - private static List ourCompiledPaths; - - public static void testSetup() { - ourDeletedPaths = new ArrayList(); - ourRecompiledPaths = new ArrayList(); - ourCompiledPaths = new ArrayList(); - } - - public static void addDeletedPath(String path) { - ourDeletedPaths.add(path); - } - - public static void addRecompiledPath(String path) { - ourRecompiledPaths.add(path); - } - - public static void addCompiledPath(String path) { - ourCompiledPaths.add(path); - } - - public static String[] getPathsToDelete() { - return ArrayUtil.toStringArray(ourDeletedPaths); - } - - public static String[] getPathsToRecompile() { - return ArrayUtil.toStringArray(ourRecompiledPaths); - } - - public static String[] getPathsToCompile() { - return ArrayUtil.toStringArray(ourCompiledPaths); - } - - public static void clearPathsToCompile() { - if (ourCompiledPaths != null) { - ourCompiledPaths.clear(); - } - } - public boolean isExcludedFromCompilation(@NotNull VirtualFile file) { return CompilerConfiguration.getInstance(myProject).isExcludedFromCompilation(file); } diff --git a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java index 5822e9433bed..5793832b8cd7 100644 --- a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java +++ b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java @@ -246,7 +246,6 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { @Override public void run() { - CompilerManagerImpl.testSetup(); final CompileStatusNotification callback = new CompileStatusNotification() { @Override public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) { @@ -256,7 +255,6 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { } ExitStatus status = CompileDriver.getExternalBuildExitStatus(compileContext); result.set(new CompilationLog(status == ExitStatus.UP_TO_DATE, - CompilerManagerImpl.getPathsToRecompile(), CompilerManagerImpl.getPathsToDelete(), generatedFilePaths, compileContext.getMessages(CompilerMessageCategory.ERROR), compileContext.getMessages(CompilerMessageCategory.WARNING))); @@ -413,20 +411,16 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { } protected class CompilationLog { - private final Set myRecompiledPaths; - private final Set myDeletedPaths; private final Set myGeneratedPaths; private final boolean myExternalBuildUpToDate; private final CompilerMessage[] myErrors; private final CompilerMessage[] myWarnings; - public CompilationLog(boolean externalBuildUpToDate, String[] recompiledPaths, String[] deletedPaths, List generatedFilePaths, - CompilerMessage[] errors, CompilerMessage[] warnings) { + public CompilationLog(boolean externalBuildUpToDate, List generatedFilePaths, CompilerMessage[] errors, + CompilerMessage[] warnings) { myExternalBuildUpToDate = externalBuildUpToDate; myErrors = errors; myWarnings = warnings; - myRecompiledPaths = getRelativePaths(recompiledPaths); - myDeletedPaths = getRelativePaths(deletedPaths); myGeneratedPaths = new THashSet(generatedFilePaths, FileUtil.PATH_HASHING_STRATEGY); } @@ -434,31 +428,10 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { assertTrue(myExternalBuildUpToDate); } - public void assertRecompiled(String... expected) { - checkRecompiled(expected); - checkDeleted(); - } - public void assertGenerated(String... expected) { assertSet("generated", myGeneratedPaths, expected); } - public void assertDeleted(String... expected) { - checkRecompiled(); - checkDeleted(expected); - } - - public void assertRecompiledAndDeleted(String[] recompiled, String... deleted) { - checkRecompiled(recompiled); - checkDeleted(deleted); - } - - private void checkRecompiled(String... expected) { - } - - private void checkDeleted(String... expected) { - } - public CompilerMessage[] getErrors() { return myErrors; } diff --git a/java/testFramework/src/com/intellij/testFramework/CompilerTester.java b/java/testFramework/src/com/intellij/testFramework/CompilerTester.java index c7ecfac84daf..414541fa23bb 100644 --- a/java/testFramework/src/com/intellij/testFramework/CompilerTester.java +++ b/java/testFramework/src/com/intellij/testFramework/CompilerTester.java @@ -15,7 +15,6 @@ */ package com.intellij.testFramework; -import com.intellij.compiler.CompilerManagerImpl; import com.intellij.compiler.CompilerTestUtil; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.Result; @@ -62,7 +61,6 @@ public class CompilerTester { myMainOutput = new TempDirTestFixtureImpl(); myMainOutput.setUp(); - CompilerManagerImpl.testSetup(); new WriteCommandAction(getProject()) { @Override protected void run(Result result) throws Throwable { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java index f947f00f1d0c..2ca35d40fca5 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java @@ -15,7 +15,6 @@ */ package org.jetbrains.idea.maven.compiler; -import com.intellij.compiler.CompilerManagerImpl; import com.intellij.compiler.CompilerTestUtil; import com.intellij.compiler.CompilerWorkspaceConfiguration; import com.intellij.compiler.artifacts.ArtifactsTestUtil; @@ -76,7 +75,6 @@ public abstract class MavenCompilingTestCase extends MavenImportingTestCase { }); CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY = true; - CompilerManagerImpl.testSetup(); final Semaphore semaphore = new Semaphore(); semaphore.down(); From e276bfa5c7e4402eb1de2896f0dfc51944e23068 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Fri, 30 May 2014 10:01:41 +0400 Subject: [PATCH 16/25] unregistering obsolete service components --- resources/src/idea/RichPlatformPlugin.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index 1a7eaee75858..ae9befc8fe2e 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -208,16 +208,10 @@ - - - Date: Fri, 30 May 2014 13:32:38 +0400 Subject: [PATCH 17/25] IDEA-125551 Start From Scratch: Customize IDEA dialog: JBoss plugin should not appear in JavaFrameworks group --- .../src/com/intellij/ide/customize/PluginGroups.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java index 3712905f766b..8a388650b15a 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java @@ -83,9 +83,8 @@ class PluginGroups { "org.intellij.grails", "com.intellij.gwt", "com.intellij.vaadin", - "JBoss", - "Seam:com.intellij.seam,com.intellij.seam.pages,com.intellij.seam.pageflow", - "JBPM", + "JBoss Seam:com.intellij.seam,com.intellij.seam.pages,com.intellij.seam.pageflow", + "JBoss jBPM:JBPM", "Struts:StrutsAssistant,com.intellij.struts2", "com.intellij.hibernate", "Spring:com.intellij.spring.batch," + From a16bfe6ff7566aed4f4bb64af8484a2488244768 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Fri, 30 May 2014 13:32:49 +0400 Subject: [PATCH 18/25] External-system: IDEA-124927 Don't refresh projects on opening when auto-import is disabled --- .../model/ExternalSystemDataKeys.java | 1 + .../service/ExternalSystemStartupActivity.java | 13 ++++++++++--- .../service/project/wizard/GradleModuleBuilder.java | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java index c2f885f4d07d..74295376e59f 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java @@ -40,6 +40,7 @@ public class ExternalSystemDataKeys { = DataKey.create("external.system.recent.tasks.list"); @NotNull public static final Key NEWLY_IMPORTED_PROJECT = new Key("external.system.newly.imported"); + @NotNull public static final Key NEWLY_CREATED_PROJECT = new Key("external.system.newly.created"); private ExternalSystemDataKeys() { } diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java index b252e8c0185d..f7040a224c3f 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java @@ -52,9 +52,16 @@ public class ExternalSystemStartupActivity implements StartupActivity { } if (project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) != Boolean.TRUE) { for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) { - ExternalSystemUtil.refreshProjects( - new ImportSpecBuilder(project, manager.getSystemId()).whenAutoImportEnabled() - ); + if (project.getUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT) == Boolean.TRUE) { + ExternalSystemUtil.refreshProjects( + new ImportSpecBuilder(project, manager.getSystemId()) + ); + } + else { + ExternalSystemUtil.refreshProjects( + new ImportSpecBuilder(project, manager.getSystemId()).whenAutoImportEnabled() + ); + } } } ExternalSystemAutoImporter.letTheMagicBegin(project); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java index 0f66ebdaf7b8..e5951134e523 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java @@ -22,6 +22,7 @@ import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.openapi.Disposable; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys; import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalModuleBuilder; import com.intellij.openapi.externalSystem.service.project.wizard.ExternalModuleSettingsStep; import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings; @@ -111,6 +112,7 @@ public class GradleModuleBuilder extends AbstractExternalModuleBuilder Date: Fri, 30 May 2014 14:06:45 +0400 Subject: [PATCH 19/25] Start plugins wizard #30 for Mac OS X should be "native" keymap by default --- .../ide/customize/CustomizeKeyboardSchemeStepPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java index 2dbbc549f9fc..2b35ebe7a6fc 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java @@ -79,7 +79,7 @@ public class CustomizeKeyboardSchemeStepPanel extends AbstractCustomizeWizardSte ButtonGroup group = new ButtonGroup(); group.add(macRadioButton); group.add(defaultRadioButton); - defaultRadioButton.setSelected(true); + macRadioButton.setSelected(true); } @Override From a489967503ce32a03b6de8e0dae49febf3e54561 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 29 May 2014 22:59:45 +0200 Subject: [PATCH 20/25] fix typo --- .../src/com/siyeh/InspectionGadgetsBundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties index 32c7b559a3c9..04419fb871e9 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties @@ -1297,7 +1297,7 @@ boolean.expression.can.be.simplified.problem.descriptor=#ref can be trivial.string.concatenation.problem.descriptor=Empty string used in concatenation string.replace.quickfix=Replace concatenation with ''{0}'' instantiating.object.to.get.class.object.replace.quickfix=Replace with direct class object access -manual.array.copy.replace.quickfix=Replace with 'System.arrayCopy()' +manual.array.copy.replace.quickfix=Replace with 'System.arraycopy()' manual.array.to.collection.copy.replace.quickfix=Replace with 'Collections.addAll(...,...)' method.may.be.static.only.option=Only check 'private' or 'final' methods method.may.be.static.empty.option=Ignore empty methods From 74d52dd5a3f69a299544b175bf68751bf7992f8c Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 30 May 2014 12:07:54 +0200 Subject: [PATCH 21/25] introduce CvsFilePath to prevent public api changes --- .../com/intellij/dvcs/test/MockVcsHelper.java | 4 +- .../openapi/vcs/AbstractVcsHelper.java | 4 +- .../vcs/history/VcsAnnotationCachedProxy.java | 7 --- .../VcsAppendableHistoryPartnerAdapter.java | 8 ---- .../VcsAppendableHistorySessionPartner.java | 5 --- .../vcs/history/FileHistoryRefresher.java | 5 +-- .../history/FileHistorySessionPartner.java | 18 +++----- ...VcsHistoryProviderBackgroundableProxy.java | 6 --- .../vcs/impl/AbstractVcsHelperImpl.java | 8 ++-- .../com/intellij/cvsSupport2/CvsFilePath.java | 38 ++++++++++++++++ .../cvsBrowser/ui/BrowserPanel.java | 5 ++- .../history/CvsHistoryProvider.java | 5 ++- .../zmlx/hg4idea/test/HgMockVcsHelper.java | 4 +- .../svn/dialogs/RepositoryBrowserDialog.java | 3 +- .../jetbrains/idea/svn/SvnHistoryTest.java | 43 ------------------- 15 files changed, 64 insertions(+), 99 deletions(-) create mode 100644 plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java diff --git a/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java b/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java index da6f7524d248..55e0a0e68b17 100644 --- a/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java +++ b/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java @@ -145,7 +145,7 @@ public class MockVcsHelper extends AbstractVcsHelper { } @Override - public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, RepositoryLocation repositoryLocation) { + public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, String repositoryPath) { throw new UnsupportedOperationException(); } @@ -153,7 +153,7 @@ public class MockVcsHelper extends AbstractVcsHelper { public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, AnnotationProvider annotationProvider, FilePath path, - RepositoryLocation repositoryLocation, + String repositoryPath, AbstractVcs vcs) { throw new UnsupportedOperationException(); } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java index f7a2a682d2ae..eb51a126234d 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java @@ -144,10 +144,10 @@ public abstract class AbstractVcsHelper { } public abstract void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, final AbstractVcs vcs, - final RepositoryLocation repositoryLocation); + final String repositoryPath); public abstract void showFileHistory(VcsHistoryProvider vcsHistoryProvider, AnnotationProvider annotationProvider, FilePath path, - final RepositoryLocation repositoryLocation, final AbstractVcs vcs); + final String repositoryPath, final AbstractVcs vcs); /** * Shows the "Rollback Changes" dialog with the specified list of changes. diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java index 65acd621a0df..ccfa15548772 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java @@ -21,7 +21,6 @@ import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.vcs.AbstractVcs; import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.RepositoryLocation; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.actions.VcsContextFactory; import com.intellij.openapi.vcs.annotate.AnnotationProvider; @@ -200,12 +199,6 @@ public class VcsAnnotationCachedProxy implements AnnotationProvider { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java index 1e795ddbe33f..515087556f4c 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java @@ -15,9 +15,7 @@ */ package com.intellij.openapi.vcs.history; -import com.intellij.openapi.vcs.RepositoryLocation; import com.intellij.openapi.vcs.VcsException; -import org.jetbrains.annotations.Nullable; /** * @author irengrig @@ -55,12 +53,6 @@ public class VcsAppendableHistoryPartnerAdapter implements VcsAppendableHistoryS public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - public void check() throws VcsException { if (myException != null) throw myException; } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java index e60917c1da81..f97cbc3d95db 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java @@ -15,9 +15,7 @@ */ package com.intellij.openapi.vcs.history; -import com.intellij.openapi.vcs.RepositoryLocation; import com.intellij.openapi.vcs.VcsException; -import org.jetbrains.annotations.Nullable; public interface VcsAppendableHistorySessionPartner { void reportCreatedEmptySession(VcsAbstractHistorySession session); @@ -26,7 +24,4 @@ public interface VcsAppendableHistorySessionPartner { void finished(); void forceRefresh(); void beforeRefresh(); - - @Nullable - RepositoryLocation getRepositoryLocation(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java index 73cf2535ff30..a3359163bd2f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java @@ -17,7 +17,6 @@ package com.intellij.openapi.vcs.history; import com.intellij.openapi.vcs.AbstractVcs; import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.RepositoryLocation; import com.intellij.openapi.vcs.annotate.AnnotationProvider; /** @@ -36,12 +35,12 @@ public class FileHistoryRefresher implements FileHistoryRefresherI { public FileHistoryRefresher(final VcsHistoryProvider vcsHistoryProvider, final AnnotationProvider annotationProvider, final FilePath path, - final RepositoryLocation repositoryLocation, + final String repositoryPath, final AbstractVcs vcs) { myVcsHistoryProvider = vcsHistoryProvider; myPath = path; myVcs = vcs; - mySessionPartner = new FileHistorySessionPartner(vcsHistoryProvider, annotationProvider, path, repositoryLocation, vcs, this); + mySessionPartner = new FileHistorySessionPartner(vcsHistoryProvider, annotationProvider, path, repositoryPath, vcs, this); myCanUseCache = true; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java index a360ba4935dc..6c9a6c25487c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java @@ -17,7 +17,10 @@ package com.intellij.openapi.vcs.history; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.ui.MessageType; -import com.intellij.openapi.vcs.*; +import com.intellij.openapi.vcs.AbstractVcs; +import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.VcsBundle; +import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.annotate.AnnotationProvider; import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; @@ -30,7 +33,6 @@ import com.intellij.ui.content.ContentManager; import com.intellij.util.BufferedListConsumer; import com.intellij.util.Consumer; import com.intellij.util.ContentsUtil; -import org.jetbrains.annotations.Nullable; import java.util.List; @@ -43,7 +45,7 @@ public class FileHistorySessionPartner implements VcsAppendableHistorySessionPar private final VcsHistoryProvider myVcsHistoryProvider; private final AnnotationProvider myAnnotationProvider; private final FilePath myPath; - private final RepositoryLocation myRepositoryLocation; + private final String myRepositoryPath; private final AbstractVcs myVcs; private final FileHistoryRefresherI myRefresherI; private volatile VcsAbstractHistorySession mySession; @@ -51,14 +53,14 @@ public class FileHistorySessionPartner implements VcsAppendableHistorySessionPar public FileHistorySessionPartner(final VcsHistoryProvider vcsHistoryProvider, final AnnotationProvider annotationProvider, final FilePath path, - final RepositoryLocation repositoryLocation, + final String repositoryPath, final AbstractVcs vcs, final FileHistoryRefresherI refresherI) { myVcsHistoryProvider = vcsHistoryProvider; myAnnotationProvider = annotationProvider; myPath = path; myLimitHistoryCheck = new LimitHistoryCheck(vcs.getProject(), path.getPath()); - myRepositoryLocation = repositoryLocation; + myRepositoryPath = repositoryPath; myVcs = vcs; myRefresherI = refresherI; myBuffer = new BufferedListConsumer(5, new Consumer>() { @@ -74,12 +76,6 @@ public class FileHistorySessionPartner implements VcsAppendableHistorySessionPar }, 1000); } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return myRepositoryLocation; - } - public void acceptRevision(VcsFileRevision revision) { myLimitHistoryCheck.checkNumber(); myBuffer.consumeOne(revision); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java index 60d7568233e7..c28a39bf1056 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java @@ -221,12 +221,6 @@ public class VcsHistoryProviderBackgroundableProxy { myPartner.beforeRefresh(); } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return myPartner.getRepositoryLocation(); - } - @Override public void forceRefresh() { myPartner.forceRefresh(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java index 32357d68fbaf..77ef5d7f2536 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java @@ -116,13 +116,13 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper { } public void showFileHistory(final VcsHistoryProvider vcsHistoryProvider, final FilePath path, final AbstractVcs vcs, - final RepositoryLocation repositoryLocation) { - showFileHistory(vcsHistoryProvider, null, path, repositoryLocation, vcs); + final String repositoryPath) { + showFileHistory(vcsHistoryProvider, null, path, repositoryPath, vcs); } public void showFileHistory(final VcsHistoryProvider vcsHistoryProvider, final AnnotationProvider annotationProvider, final FilePath path, - final RepositoryLocation repositoryLocation, final AbstractVcs vcs) { - final FileHistoryRefresherI refresherI = new FileHistoryRefresher(vcsHistoryProvider, annotationProvider, path, repositoryLocation, vcs); + final String repositoryPath, final AbstractVcs vcs) { + final FileHistoryRefresherI refresherI = new FileHistoryRefresher(vcsHistoryProvider, annotationProvider, path, repositoryPath, vcs); refresherI.run(false, true); } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java new file mode 100644 index 000000000000..aa9164bf419d --- /dev/null +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2014 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.cvsSupport2; + +import com.intellij.cvsSupport2.changeBrowser.CvsRepositoryLocation; +import com.intellij.openapi.vcs.FilePathImpl; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; + +/** + * @author Bas Leijdekkers + */ +public class CvsFilePath extends FilePathImpl { + + private final CvsRepositoryLocation myRepositoryLocation; + + public CvsFilePath(@NotNull VirtualFile virtualFile, CvsRepositoryLocation repositoryLocation) { + super(virtualFile); + myRepositoryLocation = repositoryLocation; + } + + public CvsRepositoryLocation getRepositoryLocation() { + return myRepositoryLocation; + } +} diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java index 643657de6595..caf4b597bb52 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java @@ -16,6 +16,7 @@ package com.intellij.cvsSupport2.cvsBrowser.ui; import com.intellij.CvsBundle; +import com.intellij.cvsSupport2.CvsFilePath; import com.intellij.cvsSupport2.CvsVcs2; import com.intellij.cvsSupport2.actions.cvsContext.CvsContextAdapter; import com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile; @@ -165,7 +166,7 @@ public class BrowserPanel extends JPanel implements DataProvider, CvsTabbedWindo } public void actionPerformed(AnActionEvent e) { - CvsElement[] currentSelection = myTree.getCurrentSelection(); + final CvsElement[] currentSelection = myTree.getCurrentSelection(); if (currentSelection.length != 1) return; final CvsElement cvsElement = currentSelection[0]; final VirtualFile virtualFile = cvsElement.getVirtualFile(); @@ -174,7 +175,7 @@ public class BrowserPanel extends JPanel implements DataProvider, CvsTabbedWindo final VcsHistoryProvider historyProvider = vcs.getVcsHistoryProvider(); final String moduleName = cvsElement.getElementPath(); final CvsRepositoryLocation location = new CvsRepositoryLocation(null, myCvsRootConfiguration, moduleName); - AbstractVcsHelper.getInstance(myProject).showFileHistory(historyProvider, new FilePathImpl(virtualFile), vcs, location); + AbstractVcsHelper.getInstance(myProject).showFileHistory(historyProvider, new CvsFilePath(virtualFile, location), vcs, null); } } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java index 4ab9e03f7d09..5de3880acf0c 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java @@ -16,6 +16,7 @@ package com.intellij.cvsSupport2.history; import com.intellij.CvsBundle; +import com.intellij.cvsSupport2.CvsFilePath; import com.intellij.cvsSupport2.CvsUtil; import com.intellij.cvsSupport2.application.CvsEntriesManager; import com.intellij.cvsSupport2.changeBrowser.CvsChangeList; @@ -203,9 +204,9 @@ public class CvsHistoryProvider implements VcsHistoryProvider { } public void reportAppendableHistory(FilePath path, VcsAppendableHistorySessionPartner partner) throws VcsException { - final CvsRepositoryLocation location = (CvsRepositoryLocation)partner.getRepositoryLocation(); final VcsHistorySession session; - if (location != null) { + if (path instanceof CvsFilePath) { + final CvsRepositoryLocation location = ((CvsFilePath)path).getRepositoryLocation(); final List fileRevisionList = createRevisions(location.getEnvironment(), path.getIOFile()); if (fileRevisionList == null) return; session = new MyHistorySession(fileRevisionList, path); diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java index d646170229c7..6e2414f53125 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java @@ -124,14 +124,14 @@ public class HgMockVcsHelper extends AbstractVcsHelper { } @Override - public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, RepositoryLocation repositoryLocation) { + public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, String repositoryPath) { } @Override public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, AnnotationProvider annotationProvider, FilePath path, - RepositoryLocation repositoryLocation, + String repositoryPath, AbstractVcs vcs) { } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java index 988d35c0b9ae..5fe19963cf93 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java @@ -348,10 +348,9 @@ public class RepositoryBrowserDialog extends DialogWrapper { boolean isDirectory = node.getUserObject() instanceof SVNURL || (node.getSVNDirEntry() != null && node.getSVNDirEntry().getKind() == SVNNodeKind.DIR); String url = node.getURL().toDecodedString(); - final SvnRepositoryLocation repositoryLocation = new SvnRepositoryLocation(node.getURL().toString()); AbstractVcsHelper.getInstance(myProject) - .showFileHistory(myVCS.getVcsHistoryProvider(), VcsUtil.getFilePathOnNonLocal(url, isDirectory), myVCS, repositoryLocation); + .showFileHistory(myVCS.getVcsHistoryProvider(), VcsUtil.getFilePathOnNonLocal(url, isDirectory), myVCS, url); node.reload(false); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java index ae867ab9de3a..32509217923e 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java @@ -25,7 +25,6 @@ import com.intellij.openapi.vcs.history.VcsFileRevision; import com.intellij.openapi.vcs.history.VcsHistoryProvider; import com.intellij.util.concurrency.Semaphore; import junit.framework.Assert; -import org.jetbrains.annotations.Nullable; import org.junit.Test; /** @@ -78,12 +77,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } @@ -134,12 +127,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } @@ -189,12 +176,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } @@ -248,12 +229,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } @@ -308,12 +283,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } @@ -348,12 +317,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } @@ -387,12 +350,6 @@ public class SvnHistoryTest extends Svn17TestCase { public void beforeRefresh() { } - @Nullable - @Override - public RepositoryLocation getRepositoryLocation() { - return null; - } - @Override public void forceRefresh() { } From 3a9e5394b0a35eaaf93ab6e2b5383b3984e81d8a Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Fri, 30 May 2014 14:15:33 +0400 Subject: [PATCH 22/25] IDEA-124347 Master Password prompt strategy changed for mercurial authentication * store and get password according to settings-> passwords strategy; * if 'remember password' option is selected in hg authorization dialog, IDE remembers password in memory, too --- .../execution/HgCommandAuthenticator.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java index 399fa14d078c..9a94824e2dcf 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java @@ -15,8 +15,6 @@ package org.zmlx.hg4idea.execution; import com.intellij.ide.passwordSafe.PasswordSafe; import com.intellij.ide.passwordSafe.PasswordSafeException; import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl; -import com.intellij.ide.passwordSafe.impl.PasswordSafeProvider; -import com.intellij.ide.passwordSafe.impl.providers.masterKey.MasterKeyPasswordSafe; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; @@ -55,10 +53,13 @@ class HgCommandAuthenticator { final String url = VirtualFileManager.extractPath(myRunnable.getURL()); final String key = keyForUrlAndLogin(url, myRunnable.getUserName()); - final PasswordSafeProvider provider = - myRunnable.isRememberPassword() ? passwordSafe.getMasterKeyProvider() : passwordSafe.getMemoryProvider(); try { - provider.storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword()); + if (myRunnable.isRememberPassword()) { + //save password to memory, despite of settings-> passwords + //todo should be reworked + passwordSafe.getMemoryProvider().storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword()); + } + passwordSafe.storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword()); final HgVcs vcs = HgVcs.getInstance(myProject); if (vcs != null) { vcs.getGlobalSettings().addRememberedUrl(url, myRunnable.getUserName()); @@ -129,13 +130,7 @@ class HgCommandAuthenticator { final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance(); password = passwordSafe.getMemoryProvider().getPassword(myProject, HgCommandAuthenticator.class, key); if (password == null) { - final MasterKeyPasswordSafe masterKeyProvider = passwordSafe.getMasterKeyProvider(); - if (!masterKeyProvider.isEmpty()) { - // workaround for: don't ask for master password, if the requested password is not there. - // this should be fixed in PasswordSafe: don't ask master password to look for keys - // until then we assume that is PasswordSafe was used (there is anything there), then it makes sense to look there. - password = masterKeyProvider.getPassword(myProject, HgCommandAuthenticator.class, key); - } + password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key); } } catch (PasswordSafeException e) { LOG.info("Couldn't get password for key [" + key + "]", e); From 5fd6a230368921bdcddaba7d4abf4421ffda0179 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Fri, 30 May 2014 14:26:00 +0400 Subject: [PATCH 23/25] IDEA-124082 default changelist for Commit dialog fixed when 'commit directory' called * firstly try to find any changes from selected directories (files) in active changelist --- .../vcs/actions/CommonCheckinFilesAction.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java index fd3114c63c44..43a18bb6598c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java @@ -23,9 +23,7 @@ import com.intellij.openapi.roots.FileIndexFacade; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.*; -import com.intellij.openapi.vcs.changes.Change; -import com.intellij.openapi.vcs.changes.ChangeListManager; -import com.intellij.openapi.vcs.changes.LocalChangeList; +import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vcs.checkin.CheckinEnvironment; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -67,6 +65,7 @@ public class CommonCheckinFilesAction extends AbstractCommonCheckinAction { @Override protected LocalChangeList getInitiallySelectedChangeList(final VcsContext context, final Project project) { final ChangeListManager changeListManager = ChangeListManager.getInstance(project); + LocalChangeList defaultChangeList = changeListManager.getDefaultChangeList(); final FilePath[] roots = getRoots(context); for(final FilePath root: roots) { @@ -74,9 +73,13 @@ public class CommonCheckinFilesAction extends AbstractCommonCheckinAction { if (file == null) continue; final Ref change = new Ref(); if (!file.isDirectory()) { - change.set(changeListManager.getChange(file)); + return changeListManager.getChangeList(file); } else { + if (hasChangesUnderDir(defaultChangeList, new FilePathImpl(file))) { + return defaultChangeList; + } + final FileIndexFacade index = PeriodicalTasksCloser.getInstance().safeGetService(project, FileIndexFacade.class); final VirtualFileFilter filter = new VirtualFileFilter() { public boolean accept(final VirtualFile file) { @@ -104,7 +107,21 @@ public class CommonCheckinFilesAction extends AbstractCommonCheckinAction { } } - return changeListManager.getDefaultChangeList(); + return defaultChangeList; + } + + private static boolean hasChangesUnderDir(final ChangeList changeList, final FilePath dirPath) { + for (Change change : changeList.getChanges()) { + final ContentRevision afterRevision = change.getAfterRevision(); + if (afterRevision != null && afterRevision.getFile().isUnder(dirPath, false)) { + return true; + } + final ContentRevision beforeRevision = change.getBeforeRevision(); + if (beforeRevision != null && beforeRevision.getFile().isUnder(dirPath, false)) { + return true; + } + } + return false; } private String getCheckinActionName(final VcsContext dataContext) { From a105b5b7c29cafab2368e8a82342c2a008bc083e Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 30 May 2014 13:48:20 +0400 Subject: [PATCH 24/25] IDEA-125736 new debugger: disabled all exceptions breakpoint stops at every exception even in mute mode --- .../engine/JavaBreakpointHandler.java | 13 ++- .../ui/breakpoints/BreakpointManager.java | 79 +++++++++---------- .../ui/breakpoints/ExceptionBreakpoint.java | 4 +- .../ui/breakpoints/FieldBreakpoint.java | 2 +- 4 files changed, 51 insertions(+), 47 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java index 3496894177d8..1050c99a34b1 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java @@ -36,18 +36,23 @@ public class JavaBreakpointHandler extends XBreakpointHandler { @Nullable protected Breakpoint createJavaBreakpoint(@NotNull XBreakpoint xBreakpoint) { - return BreakpointManager.getJavaBreakpoint(xBreakpoint); + return null; } @Override public void registerBreakpoint(@NotNull XBreakpoint breakpoint) { - final Breakpoint javaBreakpoint = createJavaBreakpoint(breakpoint); + Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint); + if (javaBreakpoint == null) { + javaBreakpoint = createJavaBreakpoint(breakpoint); + breakpoint.putUserData(Breakpoint.DATA_KEY, javaBreakpoint); + } if (javaBreakpoint != null) { - BreakpointManager.addBreakpointInt(javaBreakpoint); + final Breakpoint bpt = javaBreakpoint; + BreakpointManager.addBreakpoint(bpt); myProcess.getManagerThread().invoke(new DebuggerCommandImpl() { @Override protected void action() throws Exception { - javaBreakpoint.createRequest(myProcess); + bpt.createRequest(myProcess); } }); } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java index 979e675f041f..b8fa39e399c7 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java @@ -22,7 +22,6 @@ package com.intellij.debugger.ui.breakpoints; import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.DebuggerInvocationUtil; -import com.intellij.debugger.DebuggerManagerEx; import com.intellij.debugger.engine.BreakpointStepMethodFilter; import com.intellij.debugger.engine.DebugProcessImpl; import com.intellij.debugger.engine.requests.RequestManagerImpl; @@ -112,10 +111,11 @@ public class BreakpointManager { }); } - private boolean checkAndNotifyPossiblySlowBreakpoint(XBreakpoint breakpoint) { + private static boolean checkAndNotifyPossiblySlowBreakpoint(XBreakpoint breakpoint) { if (breakpoint.isEnabled() && (breakpoint.getType() instanceof JavaMethodBreakpointType || breakpoint.getType() instanceof JavaWildcardMethodBreakpointType)) { - XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING).notify(myProject); + XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING) + .notify(((XBreakpointBase)breakpoint).getProject()); return true; } return false; @@ -203,13 +203,12 @@ public class BreakpointManager { return null; } XLineBreakpoint xLineBreakpoint = addXLineBreakpoint(JavaLineBreakpointType.class, document, lineIndex); - LineBreakpoint breakpoint = LineBreakpoint.create(myProject, xLineBreakpoint); - if (breakpoint == null) { - return null; + Breakpoint breakpoint = getJavaBreakpoint(xLineBreakpoint); + if (breakpoint instanceof LineBreakpoint) { + addBreakpoint(breakpoint); + return ((LineBreakpoint)breakpoint); } - - addBreakpoint(breakpoint); - return breakpoint; + return null; } @Nullable @@ -232,11 +231,14 @@ public class BreakpointManager { public FieldBreakpoint addFieldBreakpoint(Document document, int lineIndex, String fieldName) { ApplicationManager.getApplication().assertIsDispatchThread(); XLineBreakpoint xBreakpoint = addXLineBreakpoint(JavaFieldBreakpointType.class, document, lineIndex); - FieldBreakpoint fieldBreakpoint = FieldBreakpoint.create(myProject, fieldName, xBreakpoint); - if (fieldBreakpoint != null) { - addBreakpoint(fieldBreakpoint); + Breakpoint javaBreakpoint = getJavaBreakpoint(xBreakpoint); + if (javaBreakpoint instanceof FieldBreakpoint) { + FieldBreakpoint fieldBreakpoint = (FieldBreakpoint)javaBreakpoint; + fieldBreakpoint.setFieldName(fieldName); + addBreakpoint(javaBreakpoint); + return fieldBreakpoint; } - return fieldBreakpoint; + return null; } @NotNull @@ -248,12 +250,18 @@ public class BreakpointManager { public ExceptionBreakpoint compute() { XBreakpoint xBreakpoint = XDebuggerManager.getInstance(myProject).getBreakpointManager() .addBreakpoint(type, new JavaExceptionBreakpointProperties(exceptionClassName, packageName)); - ExceptionBreakpoint breakpoint = new ExceptionBreakpoint(myProject, exceptionClassName, packageName, xBreakpoint); - addBreakpoint(breakpoint); - if (LOG.isDebugEnabled()) { - LOG.debug("ExceptionBreakpoint Added"); + Breakpoint javaBreakpoint = getJavaBreakpoint(xBreakpoint); + if (javaBreakpoint instanceof ExceptionBreakpoint) { + ExceptionBreakpoint exceptionBreakpoint = (ExceptionBreakpoint)javaBreakpoint; + exceptionBreakpoint.setQualifiedName(exceptionClassName); + exceptionBreakpoint.setPackageName(packageName); + addBreakpoint(exceptionBreakpoint); + if (LOG.isDebugEnabled()) { + LOG.debug("ExceptionBreakpoint Added"); + } + return exceptionBreakpoint; } - return breakpoint; + return null; } }); } @@ -263,13 +271,12 @@ public class BreakpointManager { ApplicationManager.getApplication().assertIsDispatchThread(); XLineBreakpoint xBreakpoint = addXLineBreakpoint(JavaMethodBreakpointType.class, document, lineIndex); - MethodBreakpoint breakpoint = MethodBreakpoint.create(myProject, xBreakpoint); - if (breakpoint == null) { - return null; + Breakpoint javaBreakpoint = getJavaBreakpoint(xBreakpoint); + if (javaBreakpoint instanceof MethodBreakpoint) { + addBreakpoint(javaBreakpoint); + return (MethodBreakpoint)javaBreakpoint; } - - addBreakpoint(breakpoint); - return breakpoint; + return null; } private > XLineBreakpoint addXLineBreakpoint(Class> typeCls, Document document, final int lineIndex) { @@ -496,14 +503,8 @@ public class BreakpointManager { return addXLineBreakpoint(typeCls, doc, line); } - public static void addBreakpointInt(@NotNull Breakpoint breakpoint) { - BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(breakpoint.getProject()).getBreakpointManager(); - breakpointManager.addBreakpoint(breakpoint); - } - - //used in Fabrique - public void addBreakpoint(@NotNull Breakpoint breakpoint) { - breakpoint.myXBreakpoint.putUserData(Breakpoint.DATA_KEY, breakpoint); + public static void addBreakpoint(@NotNull Breakpoint breakpoint) { + assert breakpoint.myXBreakpoint.getUserData(Breakpoint.DATA_KEY) == breakpoint; breakpoint.updateUI(); checkAndNotifyPossiblySlowBreakpoint(breakpoint.myXBreakpoint); } @@ -548,19 +549,17 @@ public class BreakpointManager { } @Nullable - public static Breakpoint getJavaBreakpoint(@Nullable XBreakpoint xBreakpoint) { + public static Breakpoint getJavaBreakpoint(@Nullable final XBreakpoint xBreakpoint) { if (xBreakpoint == null) { return null; } Breakpoint breakpoint = xBreakpoint.getUserData(Breakpoint.DATA_KEY); - if (breakpoint != null) { - return breakpoint; + if (breakpoint == null && xBreakpoint.getType() instanceof JavaBreakpointType) { + Project project = ((XBreakpointBase)xBreakpoint).getProject(); + breakpoint = ((JavaBreakpointType)xBreakpoint.getType()).createJavaBreakpoint(project, xBreakpoint); + xBreakpoint.putUserData(Breakpoint.DATA_KEY, breakpoint); } - Project project = ((XBreakpointBase)xBreakpoint).getProject(); - if (xBreakpoint.getType() instanceof JavaBreakpointType) { - return ((JavaBreakpointType)xBreakpoint.getType()).createJavaBreakpoint(project, xBreakpoint); - } - return null; + return breakpoint; } //interaction with RequestManagerImpl diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java index 96ee1cd18b8a..88ddf4882733 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java @@ -264,11 +264,11 @@ public class ExceptionBreakpoint extends Breakpoint Date: Fri, 30 May 2014 14:29:36 +0400 Subject: [PATCH 25/25] IDEA-125745 Controls on breakpoints dialog resize differently --- .../impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java index 0ccd181be15f..9f869ac25def 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java @@ -166,6 +166,10 @@ public class XLightBreakpointPropertiesPanel> i myCustomRightPropertiesPanelWrapper.add(customRightConditionPanel.getComponent(), BorderLayout.CENTER); myCustomPanels.add(customRightConditionPanel); } + else { + // see IDEA-125745 + myCustomRightPropertiesPanelWrapper.getParent().remove(myCustomRightPropertiesPanelWrapper); + } XBreakpointCustomPropertiesPanel customTopPropertiesPanel = breakpointType.createCustomTopPropertiesPanel(project); if (customTopPropertiesPanel != null) {