summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-02-06 14:02:54 -0800
committerTor Norbye <tnorbye@google.com>2014-02-06 14:02:59 -0800
commit70ae6f2a102f9dcd665861668cccae9590cdbef1 (patch)
treee5b3a4f2419b9f630851b209c02e14179b6fa2ba /platform
parent809cb3e73653399e59e45e0b10749a8e37b85a75 (diff)
downloadidea-70ae6f2a102f9dcd665861668cccae9590cdbef1.tar.gz
Snapshot dc1944e804515a346297e368c3b9c35a203c9912 from idea/133.818 of git://git.jetbrains.org/idea/community.git
dc1944e: Merge remote-tracking branch 'origin/133' into 133 c2e9002: Merge remote-tracking branch 'origin/133' into 133 dbd4198: IDEA-117777 Change the way native splashscreen is shown in WinLauncher IDEA-117163 Parameter "nosplash" is broken on launcher (cherry picked from commit b783716) cfcbcbb: distinct prover: do not distinguish raw type arguments from type arguments without params (IDEA-119546) (cherry picked from commit baee0eb) a1b2686: Copyright: commit document after comment updating (cherry picked from commit 0f2e2a5) 210e309: IDEA-119677 AWT thread blocking during start up 607d561: do not replace checked exception with unchecked (IDEA-119345) 34d7d0d: cls reference ignores passed outer class type arguments (IDEA-118733) afb6d22: revert (IDEA-120153) 512ceae: temp solution (IDEA-118527) (cherry picked from commit 32094bf) a1cb63e: Merge remote-tracking branch 'origin/133' into 133 b90c09e: Logo updated: 'Tools matter' moved. 87174f2: [git] Don't read default commit message from .COMMIT_EDITMSG 00bc294: Add new plugins to brokenPlugins.txt a42d688: PyCharm 3.1 artwork c7a0fea: IDEA-119510 Update Pivotal connector to correctly set "Started" and "Finished" states for stories. Unify titles of error dialogs in "Close task" and "Open task" actions. (cherry picked from commit 85bcbe8) c498973: root detection call optimized for empty root checkers (cherry picked from commit acdc335) f54d2a5: unnecessary 'else' removed (cherry picked from commit 65bce6c) 2f60cdc: style (cherry picked from commit 321cebb) 0ca33de: VcsRootDetectorI renamed (cherry picked from commit 5a75778) e8a0a07: VcsRootDetector refactoring dd9ee0b: GitRootFinder removed as unnecessary (cherry picked from commit 470ad4d) 6061019: IDEA-119738 Problem with Android Studio connecting to wrong VCS (Git vs. Mercurial) a0afcc5: style (cherry picked from commit 1195dd4) 0b6023f: Mercurial Repository info problem fixed eae61e9: style (cherry picked from commit 96ec395) 6be71da: Unnecessary parameter --ignore removed from appropriate status commands. 8d896ca: Annotate for renamed/moved file fixed 95fe78f: getFileNameInTargetRevision updated 2eb0039: VcsRoot detector tests updated 5a89ec5: VcsRootError changed to be an interface, implementation moved to vcs-impl (cherry picked from commit 49815e2) 6e7297f: Reverted percent formatting by default for MySQL parser compatibility with Python (PY-10771) c92b0d9: Fixed add method quick fix after changing the element reported by the unresolved references inspection cede286: do not prefer simple python run configuration over tests fa2e308: do not prefer simple python run configuration over custom (django, etc.) 5bdf739: Don't use JSON to store broken plugins. Loading JSON on startup take 50m.s. e2617c0: Fill brokenPlugins.json (cherry picked from commit ebf4294) 50938aa: [git] IDEA-120042 Protect against zero timestamp 03b587d: Kill Python console with SIGKILL, because SIGINT generates KeyboardInterrupt and closes nothing. (cherry picked from commit 35603ff416a1c6b95d2ba4459fcc7bbb864315a1) 24baeea: NotNull annotation. (cherry picked from commit 8bf273fc402c574fe67f39f0a43018e0b3758cdd) 4fb7ecf: NotNull annotation. (cherry picked from commit 8204f64b865634da512600488441c5001e902c5d) 13a9206: NPE (EA-52843) (cherry picked from commit 5f2c78ef5b3b574d620aa3abe6a619c7deb143f5) 5bb5de4: EA-49160 (cherry picked from commit 2e82518e58e42959f9153f2685a1fb6c924b524e) d33f8a2: NPE(EA-52907). (cherry picked from commit b44000de9a05193e218d159565a40e10d0770afa) eb15fe6: IOOBE (EA-53138). (cherry picked from commit 1ac0a958e7902e9503b1584aa9a5099a5645592a) 5a76e10: SIOOBE(EA-53677). (cherry picked from commit 8e887d7) d0de4d4: Fixed spelling in names of variables (cherry picked from commit e37f9b1) 43d19a0: Simplified always true expressions (cherry picked from commit 61f5888) 0d1f896: Fixed EA-49990: assert: TextRange.<init> bf30c71: Fixed EA-52685 - assert: MultiHostRegistrarImpl.doneInjecting 845984e: Reordered methods (cherry picked from commit 35afccf) 4bd4b91: Fixed SQL 'select/insert/...' rule injection into indented string literals (PY-11970) (cherry picked from commit 5fd0a91) afc90e9: Assume that string without '%' operator or 'format()' contains no formatting (PY-11771) (cherry picked from commit 2621f17) 58b30ff: Don't run code analysis for injections with interpolation in string formatting (PY-11962) (cherry picked from commit 6e66b22) e7ff3f0: Add injection place even if a string fragment consists of zero chunks (cherry picked from commit e4bf6e4) 077db26: Fixed parsing of unbalanced new style string formatting (PY-11962) (cherry picked from commit 76e0d23) d1d3177: IDEA-56096 Allow to create file templates with extension contains dot [CR-IC-3923] (cherry picked from commit c1728ca) ef7c9e4: assume custom stubs only if psifile's content element type isn't IStubElementType, this fixes performance problem of previous change (that added support for dom indices). The performance problem was manifested for flex stubs produced by decompiler. (cherry picked from commit 4b5b6e8) 7ab32ff: IDEA-119773 (slf4j placeholder inspection false warnings when passing in Object array) (cherry picked from commit d8e1c94) f6951b4: high CPU and EditorTextField/LanguageConsole scrolling ef19cd4: [git] IDEA-119887 Support one more git version output format 6ebae26: [git] convert GitVersionTest to junit 86970d3: Add brokenPlugins.json 2f5b006: [^Peter] IDEA-117390 don't complete light elements containing IntelliJIdeaRulezzz 3abd741: [^peter]IDEA-119647 CCE on groovy file 585208a: Merge remote-tracking branch 'origin/133' into 133 6257aa0: PyCharm 3.1 a7af6ae: Gradle: buildscript configuration respect inheritance (cherry picked from commit 0f133cf) d2311e1: [github] IDEA-119693 Don't share workspace.xml 8ed66a5: EA-53411 (more reliable diagnostic and better recovery) 7ac7972: IDEA-119498 (only suppress plugin updates for true command-line usage) db1690c: IDEA-55171 (prevent sync refresh from locking if application is disposed) f9286bb: fixed merge problem: extra test method was added 5b068d0: Traverse class owners via ScopeUtil in order to prevent switching from stubs to AST 527b224: Compare decorators by name preventing unnecessary switch from stubs to AST d4d3308: Fix CCE (PY-10999). 8e0523a: Setup __loader__ for __main__ module (PY-10535). 273934b: Added test for PY-11337 989d3a3: PY-3569 Inspection to warn if a loop variable is assigned inside the loop 44efd68: fixed EA-53497 - assert: TextRange.<init> 85c7dee: better fix for IDEA-111684 (cherry picked from commit bb558e8) 50207de: 13.0.3 EAP e3dcc49: IDEA-103743 Settings > Code Style > Arrangement UI glitch (after-review improvement) (cherry picked from commit 4269a85) f6d1bd3: 1) IDEA-103743 Settings > Code Style > Arrangement UI glitch 2) checkbox unselection doesn't disable combobox (cherry picked from commit b788397) e145138: Do not allow view to be larger than viewport with SCROLLBAR_NEVER policy 5ea4a3b: IDEA-118601 New Module: Maven: click on "Create from archetype" reverts typed coordinates. (cherry picked from commit 34d1109) +review CR-IC-3798 83fe636: hotfix: IDEA-119851 Gradle: the "out-of-process" mode doesn't work 0d06fcd: Merge branch '133' of git.labs.intellij.net:idea/community into 133 c1c74dc: Revert "updated external tools. Added annoying *.whl for the needs of virtualenv." 5e91a0d: advance bomb 37c6d1b: add read action (EA-51111) 239497a: read action 9f91062: PY-11882 Assignment to for loop inspection false positive PY-3569 Inspection to warn if a loop variable is assigned inside the loop c571c78: Don't analyze target expressions not located in the current file 59eff48: PY-6955 Unused import not greyed out if also failing 2db3187: PY-6955 Unused import not greyed out if also failing db42545: PY-6955 Unused import not greyed out if also failing (test refactored) 7aa1822: PY-3569 Inspection to warn if a loop variable is assigned inside the loop 086e91e: PY-3569 Inspection to warn if a loop variable is assigned inside the loop a4d9d17: updated external tools. Added annoying *.whl for the needs of virtualenv. e03288e: Cache presence or absence of a user skeleton for file in its user data 0f403e5: Rewritten PyQualifiedReference.collectAssignedAttributes() for better performance cff2993: Cache the result of asQualifiedName() 938b089: Forgot call to super 5c00d1f: fixed missing sys import 7a48578: Disabled comment injector for Python for performance reasons 6e1a348: fixed missing sys import ecc919e: fixed PY-11561 "Add super class call" incorrectly inserts parameter annotations 30556f2: fixed PY-11495 Create function: do not propose quick-fix for unresolved parts of fqn 3697485: fixed PY-11484 Implement abstract method: pushes docstring out of the way 5fa3f46: fixed isAbstractmethod 40ad42e: Fix align multiline elements in parenthesized expressions, parameters and arguments lists. 269d729: Cleanup of API for qualified names of expressions 51fb114: Method call in indenting statement should have continuation indent. a29830e: fixed PY-11353 Creating Run Configuration from specific test gets the "target" wrong 4cbbccb: fixed PY-11312 False positive CamelCase variable imported as lowercase 72ace3a: fixed PY-11281 Convert dict comprehension to dict call omits if expression 145c46c: Deprecated PyResolveUtil.treeCrawlUp() as a slow way of traversing the PSI 04eb283: Made several internal methods of PyResolveUtil private ffe45f7: fixed PY-11277 Python: Wrong "argument equals default" inspection 819364e: fixed PY-11617 Nosetest runner: simple function tests cannot jump to source 9b389fc: fixed PY-11696 Cancel after adding new interpreter removes configured project interpreter a74d7e3: proper fix for PY-11879 23a7505: Added PyQualifiedReference.isQualified() that potentially doesn't require AST access 5991dac: Use ScopeUtil.getScopeOwner() for preventing unnecessary stubs to AST switch 04a4e01: fixed PY-11340 Invalid case for can't assign to literal inspection 0f03c21: fixed PY-11341 Invalid case for identifier expected inspection after as in with statement 90143fb: Fix continuation indentation in while statement (PY-11869). bba7892: default test runner is unittest 92d2caf: Cache the results of asQualifiedName() for performance reasons 7a9fffc: Indent comment in tuple (PY-11904). 5c7ac44: Fixed test data to satisfy PEP8. 1d845d9: fixed PY-11879 Refactor: Rename: references in ivar directive are not updated 50bcfc0: fixed PY-11884 Missing completion for finally keyword after else statement f2a14b8: Insert two spaces before line comment (PY-11901). 17e208c: Fix indent in parenthesized expression in indenting statement (PY-11868). 04c1a4a: Inject SQL only into strings that have SELECT/UPDATE... at the beginning 40ddc62: fixed PY-11428 "Variable in function should be lowercase" false positive for variables declared global e214615: Try stub-based containers for Python PSI elements instead of getParent() b7f8286: Use hasDefaultValue() instead of getDefaultValue() in order to prevent switching from stubs to AST 4831476: Qualified targets are never local 68e8c17: Use isQualified() instead of getQualifier() in order to prevent switching from stubs to AST d351953: Find owner via ScopeUtil in order to prevent switching from stubs to AST 28b4b21: Note about stubs to AST 65a8a45: Traverse class owners via ScopeUtil in order to prevent switching from stubs to AST 51aef87: Compare decorators by name preventing unnecessary switch from stubs to AST df0f3bb: Fixed NPE 9da12c1: Calculate iteration type via types, not PyClass elements ae275ce: fixed PY-11875 Pycharm code analysis stalls on specific code (caused by AIOOB in getArguments of decorator) a38300c: Removed redundant PyTypeProvider.getIterationType() 8e05ff9: Types of Enum members' fields and type of Enum.__members__ 94cb03f: Fixed PyABCUtil.isSubtype() check for class definitions that have metaclasses 0060111: Type provider for enum.Enum members cbb65bb: Store metaclass qualified name in class stub for better performance 79b43ed: Added PyClass.getMetaClassExpression() 7916719: Extracted getMetaClassExpression() 44a5f41: Evaluate metaclass type using TypeEvalContext 55fdf8e: Check __metaclass__ attribute only for Python 2.x 7afe4fc: Refactored PyUtil.getMetaClass() into PyClass.getMetaClassType() 14f98ae: Keywords already contains 'as' and 'with' c38e6a3: Merge PyKeywords with PyNames c4a0746: Extracted PyStdlibTypeProvider.getNamedTupleType() Change-Id: Ia6001b030336ec63b47f7b49d53a595cc7fc0598
Diffstat (limited to 'platform')
-rw-r--r--platform/bootstrap/src/com/intellij/ide/Bootstrap.java10
-rw-r--r--platform/indexing-api/src/com/intellij/psi/search/SearchRequestCollector.java13
-rw-r--r--platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java13
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/group/ArrangementGroupingComponent.java7
-rw-r--r--platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FTManager.java30
-rw-r--r--platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateBase.java2
-rw-r--r--platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java6
-rw-r--r--platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplatesLoader.java10
-rw-r--r--platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java2
-rw-r--r--platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java12
-rw-r--r--platform/platform-api/src/com/intellij/ui/components/JBViewport.java59
-rw-r--r--platform/platform-impl/src/com/intellij/idea/StartupUtil.java5
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java4
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java4
-rw-r--r--platform/platform-resources-en/src/messages/CodeInsightBundle.properties1
-rw-r--r--platform/platform-resources/src/META-INF/VcsExtensions.xml2
-rw-r--r--platform/platform-resources/src/brokenPlugins.txt13
-rw-r--r--platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java4
-rw-r--r--platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootError.java61
-rw-r--r--platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootFinder.java2
-rw-r--r--platform/vcs-api/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java28
-rw-r--r--platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java14
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/VcsRootErrorImpl.java76
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectInfo.java44
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectorImpl.java (renamed from platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java)53
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootErrorsFinder.java9
-rw-r--r--platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootConfiguration.java92
-rw-r--r--platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootDetectorTest.java115
-rw-r--r--platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootErrorsFinderTest.java223
-rw-r--r--platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootPlatformTest.java8
-rw-r--r--platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogMultiRepoJoiner.java4
31 files changed, 557 insertions, 369 deletions
diff --git a/platform/bootstrap/src/com/intellij/ide/Bootstrap.java b/platform/bootstrap/src/com/intellij/ide/Bootstrap.java
index 847062c47e5e..00fab132e1db 100644
--- a/platform/bootstrap/src/com/intellij/ide/Bootstrap.java
+++ b/platform/bootstrap/src/com/intellij/ide/Bootstrap.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.ide;
+import com.intellij.idea.Main;
import com.intellij.util.lang.UrlClassLoader;
import java.lang.reflect.Method;
@@ -24,13 +25,16 @@ import java.lang.reflect.Method;
*/
public class Bootstrap {
private static final String PLUGIN_MANAGER = "com.intellij.ide.plugins.PluginManager";
+
+ /** @deprecated use StartupUtil.NO_SPLASH if needed (to remove in 134.x) */
+ @SuppressWarnings({"UnusedDeclaration", "SpellCheckingInspection"})
public static final String NO_SPLASH = "nosplash";
private Bootstrap() { }
public static void main(String[] args, String mainClass, String methodName) throws Exception {
- UrlClassLoader newClassLoader = BootstrapClassLoaderUtil.initClassLoader(args.length == 0 || args.length == 1 &&
- NO_SPLASH.equals(args[0]));
+ boolean updatePlugins = !Main.isCommandLine();
+ UrlClassLoader newClassLoader = BootstrapClassLoaderUtil.initClassLoader(updatePlugins);
WindowsCommandLineProcessor.ourMirrorClass = Class.forName(WindowsCommandLineProcessor.class.getName(), true, newClassLoader);
diff --git a/platform/indexing-api/src/com/intellij/psi/search/SearchRequestCollector.java b/platform/indexing-api/src/com/intellij/psi/search/SearchRequestCollector.java
index f11b5fbf9b65..fef43be72ba5 100644
--- a/platform/indexing-api/src/com/intellij/psi/search/SearchRequestCollector.java
+++ b/platform/indexing-api/src/com/intellij/psi/search/SearchRequestCollector.java
@@ -16,6 +16,8 @@
package com.intellij.psi.search;
import com.intellij.codeInsight.ContainerProvider;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFileSystemItem;
@@ -82,9 +84,14 @@ public class SearchRequestCollector {
searchWord(word, searchScope, searchContext, caseSensitive, getContainerName(searchTarget), processor);
}
- private static String getContainerName(@NotNull PsiElement target) {
- PsiElement container = getContainer(target);
- return container instanceof PsiNamedElement ? ((PsiNamedElement)container).getName() : null;
+ private static String getContainerName(@NotNull final PsiElement target) {
+ return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
+ @Override
+ public String compute() {
+ PsiElement container = getContainer(target);
+ return container instanceof PsiNamedElement ? ((PsiNamedElement)container).getName() : null;
+ }
+ });
}
private static PsiElement getContainer(@NotNull PsiElement refElement) {
diff --git a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
index 27f7d10b1646..9355f443f6f1 100644
--- a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
+++ b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
@@ -44,10 +44,15 @@ public abstract class StubProcessingHelperBase {
if (_psifile instanceof PsiFileWithStubSupport) {
psiFile = (PsiFileWithStubSupport)_psifile;
stubTree = psiFile.getStubTree();
- if (stubTree == null && psiFile instanceof PsiFileImpl) {
- BinaryFileStubBuilder stubBuilder = BinaryFileStubBuilders.INSTANCE.forFileType(psiFile.getFileType());
- if (stubBuilder == null) stubTree = ((PsiFileImpl)psiFile).calcStubTree();
- else customStubs = true;
+ if (stubTree == null && psiFile instanceof PsiFileImpl) {
+ IElementType contentElementType = ((PsiFileImpl)psiFile).getContentElementType();
+ if (contentElementType instanceof IStubFileElementType) {
+ stubTree = ((PsiFileImpl)psiFile).calcStubTree();
+ }
+ else {
+ customStubs = true;
+ assert BinaryFileStubBuilders.INSTANCE.forFileType(psiFile.getFileType()) != null;
+ }
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/group/ArrangementGroupingComponent.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/group/ArrangementGroupingComponent.java
index c86f3ca734f1..4bb84a63e397 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/group/ArrangementGroupingComponent.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/group/ArrangementGroupingComponent.java
@@ -101,7 +101,7 @@ public class ArrangementGroupingComponent extends JPanel implements ArrangementR
myGroupingTypeToken.setListener(new ArrangementUiComponent.Listener() {
@Override
public void stateChanged() {
- myOrderTypeToken.setEnabled(myGroupingTypeToken.isEnabled());
+ myOrderTypeToken.setEnabled(myGroupingTypeToken.isSelected());
}
});
}
@@ -123,6 +123,7 @@ public class ArrangementGroupingComponent extends JPanel implements ArrangementR
setBackground(UIUtil.getListBackground());
setBorder(IdeBorderFactory.createEmptyBorder(ArrangementConstants.VERTICAL_GAP));
+ setOpaque(!UIUtil.isUnderIntelliJLaF() && !UIUtil.isUnderNativeMacLookAndFeel() && !UIUtil.isUnderDarcula());
}
@Override
@@ -135,6 +136,10 @@ public class ArrangementGroupingComponent extends JPanel implements ArrangementR
myRowIndexControl.setBaseLine(baseline);
}
}
+ if (UIUtil.isUnderIntelliJLaF() || UIUtil.isUnderDarcula() || UIUtil.isUnderNativeMacLookAndFeel()) {
+ g.setColor(getBackground());
+ g.fillRect(1, 1, getWidth() - 2, getHeight() - 2);
+ }
super.paintComponent(g);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FTManager.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FTManager.java
index b1b6cec2d2ad..5e425be9e82b 100644
--- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FTManager.java
+++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FTManager.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
@@ -43,6 +44,7 @@ class FTManager {
public static final String DEFAULT_TEMPLATE_EXTENSION = "ft";
public static final String TEMPLATE_EXTENSION_SUFFIX = "." + DEFAULT_TEMPLATE_EXTENSION;
public static final String CONTENT_ENCODING = CharsetToolkit.UTF8;
+ private static final String ENCODED_NAME_EXT_DELIMITER = "\u0F0Fext\u0F0F.";
private final String myName;
private final boolean myInternal;
@@ -119,8 +121,11 @@ class FTManager {
// templateName must be non-qualified name, since previous lookup found nothing
for (FileTemplateBase t : getAllTemplates(false)) {
final String qName = t.getQualifiedName();
- if (qName.startsWith(templateName) && qName.charAt(templateName.length()) == '.') {
- return t;
+ if (qName.startsWith(templateName) && qName.length() > templateName.length()) {
+ String remainder = qName.substring(templateName.length());
+ if (remainder.startsWith(ENCODED_NAME_EXT_DELIMITER) || remainder.charAt(0) == '.') {
+ return t;
+ }
}
}
return null;
@@ -193,7 +198,7 @@ class FTManager {
return bundled;
}
- void saveTemplates() {
+ public void saveTemplates() {
final File configRoot = getConfigRoot(true);
final File[] files = configRoot.listFiles();
@@ -262,7 +267,7 @@ class FTManager {
* todo: review saving algorithm
*/
private static void saveTemplate(File parentDir, FileTemplateBase template, final String lineSeparator) throws IOException {
- final File templateFile = new File(parentDir, template.getName() + "." + template.getExtension());
+ final File templateFile = new File(parentDir, encodeFileName(template.getName(), template.getExtension()));
FileOutputStream fileOutputStream;
try {
@@ -310,4 +315,21 @@ class FTManager {
return myName + " file template manager";
}
+ public static String encodeFileName(String templateName, String extension) {
+ String nameExtDelimiter = extension.contains(".") ? ENCODED_NAME_EXT_DELIMITER : ".";
+ return templateName + nameExtDelimiter + extension;
+ }
+
+ public static Pair<String,String> decodeFileName(String fileName) {
+ String name = fileName;
+ String ext = "";
+ String nameExtDelimiter = fileName.contains(ENCODED_NAME_EXT_DELIMITER) ? ENCODED_NAME_EXT_DELIMITER : ".";
+ int extIndex = fileName.lastIndexOf(nameExtDelimiter);
+ if (extIndex >= 0) {
+ name = fileName.substring(0, extIndex);
+ ext = fileName.substring(extIndex + nameExtDelimiter.length());
+ }
+ return new Pair<String,String>(name, ext);
+ }
+
}
diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateBase.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateBase.java
index a9f237488ea0..73ee43594f87 100644
--- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateBase.java
+++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateBase.java
@@ -54,7 +54,7 @@ public abstract class FileTemplateBase implements FileTemplate {
}
public static String getQualifiedName(final String name, final String extension) {
- return name + "." + extension;
+ return FTManager.encodeFileName(name, extension);
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java
index 944cbc28a5f7..be3be30fc247 100644
--- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java
@@ -26,7 +26,6 @@ import com.intellij.lexer.FlexAdapter;
import com.intellij.lexer.Lexer;
import com.intellij.lexer.MergingLexerAdapter;
import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
@@ -305,11 +304,6 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
myTemplate.setText(myTemplateEditor.getDocument().getText());
String name = myNameField.getText();
String extension = myExtensionField.getText();
- int lastDotIndex = extension.lastIndexOf(".");
- if (lastDotIndex >= 0) {
- name += extension.substring(0, lastDotIndex + 1);
- extension = extension.substring(lastDotIndex + 1);
- }
if (name.length() == 0 || !isValidFilename(name + "." + extension)) {
throw new ConfigurationException(IdeBundle.message("error.invalid.template.file.name.or.extension"));
}
diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplatesLoader.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplatesLoader.java
index a067ed39bc0c..d3c230fe8952 100644
--- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplatesLoader.java
+++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplatesLoader.java
@@ -22,6 +22,7 @@ import com.intellij.ide.plugins.cl.PluginClassLoader;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.PluginDescriptor;
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
+import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.lang.UrlClassLoader;
import org.jetbrains.annotations.NotNull;
@@ -191,7 +192,7 @@ public class FileTemplatesLoader {
}
}
- private void loadCustomizedContent(FTManager manager) {
+ void loadCustomizedContent(FTManager manager) {
final File configRoot = manager.getConfigRoot(false);
final File[] configFiles = configRoot.listFiles();
if (configFiles == null) {
@@ -226,9 +227,10 @@ public class FileTemplatesLoader {
}
}
- private void addTemplateFromFile(FTManager manager, String templateQName, File file) {
- final String extension = myTypeManager.getExtension(templateQName);
- templateQName = templateQName.substring(0, templateQName.length() - extension.length() - 1);
+ private static void addTemplateFromFile(FTManager manager, String fileName, File file) {
+ Pair<String,String> nameExt = FTManager.decodeFileName(fileName);
+ final String extension = nameExt.second;
+ final String templateQName = nameExt.first;
if (templateQName.length() == 0) {
return;
}
diff --git a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
index db58f85992d5..0e7ddb332151 100644
--- a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
+++ b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
@@ -29,7 +29,7 @@ public abstract class ToolWindowManager {
public abstract boolean canShowNotification(@NotNull String toolWindowId);
- public static ToolWindowManager getInstance(Project project){
+ public static ToolWindowManager getInstance(@NotNull Project project){
return project.getComponent(ToolWindowManager.class);
}
diff --git a/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java b/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java
index febb5b26dd80..c4694d745975 100644
--- a/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java
+++ b/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 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.
@@ -15,10 +15,12 @@
*/
package com.intellij.ui;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
import java.awt.*;
/**
@@ -42,8 +44,12 @@ public abstract class ListCellRendererWrapper<T> implements ListCellRenderer {
@SuppressWarnings("UndesirableClassUsage")
public ListCellRendererWrapper() {
- myDefaultRenderer = new JComboBox().getRenderer();
- assert myDefaultRenderer != null : "LaF: " + UIManager.getLookAndFeel();
+ ListCellRenderer renderer = new JComboBox().getRenderer();
+ if (renderer == null) {
+ renderer = new BasicComboBoxRenderer();
+ Logger.getInstance(this.getClass()).error("LaF: " + UIManager.getLookAndFeel());
+ }
+ myDefaultRenderer = renderer;
}
public final Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBViewport.java b/platform/platform-api/src/com/intellij/ui/components/JBViewport.java
index 4e9887771d93..76ea93e94684 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBViewport.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBViewport.java
@@ -15,9 +15,11 @@
*/
package com.intellij.ui.components;
+import com.intellij.openapi.ui.TypingTarget;
import com.intellij.ui.table.JBTable;
import com.intellij.util.ui.ComponentWithEmptyText;
import com.intellij.util.ui.StatusText;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -26,9 +28,49 @@ import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
public class JBViewport extends JViewport implements ZoomableViewport {
+ private static final ViewportLayout ourLayoutManager = new ViewportLayout() {
+
+ @Override
+ public void layoutContainer(Container parent) {
+ JBViewport viewport = (JBViewport)parent;
+ Component view = viewport.getView();
+ JBScrollPane scrollPane = UIUtil.getParentOfType(JBScrollPane.class, parent);
+ // do not force viewport size on editor component, e.g. EditorTextField and LanguageConsole
+ if (view == null || scrollPane == null || view instanceof TypingTarget) {
+ super.layoutContainer(parent);
+ return;
+ }
+
+ Dimension size = doSuperLayoutContainer(viewport);
+
+ Dimension visible = viewport.getExtentSize();
+ if (scrollPane.getHorizontalScrollBarPolicy() == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) {
+ size.width = visible.width;
+ }
+ if (scrollPane.getVerticalScrollBarPolicy() == ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER) {
+ size.height = visible.height;
+ }
+ viewport.setViewSize(size);
+ }
+
+ private Dimension doSuperLayoutContainer(JBViewport viewport) {
+ try {
+ viewport.mySaveTempViewSize = true;
+ super.layoutContainer(viewport);
+ }
+ finally {
+ viewport.mySaveTempViewSize = false;
+ }
+ return viewport.myTempViewSize;
+ }
+ };
+
private StatusText myEmptyText;
private ZoomingDelegate myZoomer;
+ private Dimension myTempViewSize;
+ private boolean mySaveTempViewSize;
+
public JBViewport() {
addContainerListener(new ContainerListener() {
@Override
@@ -52,6 +94,23 @@ public class JBViewport extends JViewport implements ZoomableViewport {
}
@Override
+ protected LayoutManager createLayoutManager() {
+ return ourLayoutManager;
+ }
+
+ @Override
+ public void setViewSize(Dimension newSize) {
+ // only store newSize from ViewportLayout.layoutContainer
+ // if we're going to fix it the next moment in our layoutContainer code
+ if (mySaveTempViewSize) {
+ myTempViewSize = newSize;
+ }
+ else {
+ super.setViewSize(newSize);
+ }
+ }
+
+ @Override
public void paint(Graphics g) {
if (myZoomer != null && myZoomer.isActive()) {
myZoomer.paint(g);
diff --git a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java
index ef37fd97a7ee..0a498561bd64 100644
--- a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java
+++ b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 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.
@@ -15,7 +15,6 @@
*/
package com.intellij.idea;
-import com.intellij.ide.Bootstrap;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.application.ConfigImportHelper;
@@ -47,7 +46,7 @@ import java.util.List;
* @author yole
*/
public class StartupUtil {
- @NonNls public static final String NO_SPLASH = Bootstrap.NO_SPLASH;
+ @NonNls public static final String NO_SPLASH = "nosplash";
private static SocketLock ourLock;
private static String myDefaultLAF;
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java
index 1a49ff2b1bda..6a0be3f96b95 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java
@@ -82,11 +82,9 @@ public class RefreshQueueImpl extends RefreshQueue {
}
}
finally {
- final Application app = ApplicationManager.getApplication();
- app.invokeLater(new DumbAwareRunnable() {
+ ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
@Override
public void run() {
- if (app.isDisposed()) return;
session.fireEvents(false);
}
}, modality);
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java
index d58cbb4b4e9e..f7ad09abf223 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 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.
@@ -161,7 +161,7 @@ public class RefreshSessionImpl extends RefreshSession {
public void fireEvents(boolean hasWriteAction) {
try {
- if (!iHaveEventsToFire) return;
+ if (!iHaveEventsToFire || ApplicationManager.getApplication().isDisposed()) return;
if (hasWriteAction) {
fireEventsInWriteAction();
diff --git a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
index e1bbe4d131b3..c9ac1ac705f2 100644
--- a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
+++ b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
@@ -491,3 +491,4 @@ dialog.edit.template.checkbox.html.text=HTML Text
dialog.edit.template.checkbox.xsl.text=XSL Text
highlight.imported.classes.chooser.title=Choose Imported Classes to Highlight
highlight.imported.members.chooser.title=Choose Imported Members to Highlight
+javadoc.resolved.value=Resolved value\: \ No newline at end of file
diff --git a/platform/platform-resources/src/META-INF/VcsExtensions.xml b/platform/platform-resources/src/META-INF/VcsExtensions.xml
index b2d032028189..a8ef04f81c62 100644
--- a/platform/platform-resources/src/META-INF/VcsExtensions.xml
+++ b/platform/platform-resources/src/META-INF/VcsExtensions.xml
@@ -13,6 +13,8 @@
<projectService serviceImplementation="com.intellij.openapi.vcs.contentAnnotation.VcsContentAnnotationSettings"/>
<projectService serviceImplementation="com.intellij.openapi.diff.impl.settings.MergeToolSettings"/>
<projectService serviceImplementation="com.intellij.openapi.diff.impl.settings.DiffToolSettings"/>
+ <projectService serviceInterface="com.intellij.openapi.vcs.roots.VcsRootDetector"
+ serviceImplementation="com.intellij.openapi.vcs.roots.VcsRootDetectorImpl"/>
<selectInTarget implementation="com.intellij.openapi.vcs.changes.SelectInChangesViewTarget"/>
diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt
new file mode 100644
index 000000000000..5983a4d5afe0
--- /dev/null
+++ b/platform/platform-resources/src/brokenPlugins.txt
@@ -0,0 +1,13 @@
+// This file contains list of broken plugins.
+// Each line contains plugin ID and list of versions that are broken.
+// If plugin name or version contains a space you can quote it like in command line.
+
+NodeJS 133.74 133.50 133.373 133.293 133.260 133.195 133.162 133.134
+com.jetbrains.php 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12
+org.intellij.clojure 0.7.60
+org.intellij.scala 0.29.464 0.28.366 0.23.308
+org.jetbrains.plugins.ruby 6.0.0.20131207 6.0.0.20131121
+Karma 133.50
+com.jetbrains.lang.ejs 131.17 131.12
+com.jetbrains.twig 133.51 130.1639
+org.jetbrains.kannotator 0.2.420 \ No newline at end of file
diff --git a/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java b/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java
index 902067f261c2..ce6c138c3697 100644
--- a/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 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.
@@ -29,7 +29,7 @@ import java.util.List;
public class FinderRecursivePanelSelectionUpdateTest extends PlatformTestCase {
- @Bombed(year = 2014, month = Calendar.JANUARY, day = 31, user = "Yann Cebron")
+ @Bombed(year = 2014, month = Calendar.MARCH, day = 1, user = "Yann Cebron")
public void testUpdate() throws InterruptedException {
StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject()) {
@NotNull
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootError.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootError.java
index ada11256da9a..3074d44c843d 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootError.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootError.java
@@ -23,61 +23,28 @@ import org.jetbrains.annotations.NotNull;
* @author Kirill Likhodedov
* @see VcsRootChecker
*/
-public class VcsRootError {
+public interface VcsRootError {
- private final @NotNull Type myType;
- private final @NotNull String myMapping;
- private final @NotNull VcsKey myVcsKey;
-
- public enum Type {
+ enum Type {
EXTRA_MAPPING,
UNREGISTERED_ROOT
}
- public VcsRootError(@NotNull Type type, @NotNull String mapping, @NotNull String key) {
- myType = type;
- myMapping = mapping;
- myVcsKey = new VcsKey(key);
- }
-
+ /**
+ * @return type of mapping error
+ */
@NotNull
- public Type getType() {
- return myType;
- }
+ Type getType();
+ /**
+ * @return affected directory mapping string
+ */
@NotNull
- public String getMapping() {
- return myMapping;
- }
+ String getMapping();
+ /**
+ * @return vcsKey for affected mapping
+ */
@NotNull
- public VcsKey getVcsKey() {
- return myVcsKey;
- }
-
- @Override
- public String toString() {
- return String.format("VcsRootError{%s - %s}", myType, myMapping);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- VcsRootError error = (VcsRootError)o;
-
- if (!myMapping.equals(error.myMapping)) return false;
- if (myType != error.myType) return false;
-
- return true;
- }
-
- @SuppressWarnings("ConstantConditions")
- @Override
- public int hashCode() {
- int result = myType != null ? myType.hashCode() : 0;
- result = 31 * result + myMapping.hashCode();
- return result;
- }
+ VcsKey getVcsKey();
}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootFinder.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootFinder.java
index b3b696e8f048..473b722e8957 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootFinder.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRootFinder.java
@@ -8,7 +8,7 @@ import java.util.Collection;
/**
* @author Denis Zhdanov
- * @since 7/18/13 3:53 PM
+ * @deprecated use {@link com.intellij.openapi.vcs.roots.VcsRootDetector} instead
*/
public interface VcsRootFinder {
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java b/platform/vcs-api/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java
new file mode 100644
index 000000000000..23a7e6b89cee
--- /dev/null
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java
@@ -0,0 +1,28 @@
+package com.intellij.openapi.vcs.roots;
+
+import com.intellij.openapi.vcs.VcsRoot;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+/**
+ * Interface for detecting VCS roots in the project.
+ *
+ * @author Nadya Zabrodina
+ */
+public interface VcsRootDetector {
+
+ /**
+ * Detect vcs roots for whole project
+ */
+ @NotNull
+ Collection<VcsRoot> detect();
+
+ /**
+ * Detect vcs roots for startDir
+ */
+ @NotNull
+ Collection<VcsRoot> detect(@Nullable VirtualFile startDir);
+}
diff --git a/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java b/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
index 709318330b84..f49131ca622f 100644
--- a/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
+++ b/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -38,6 +39,7 @@ import com.intellij.openapi.vcs.actions.VcsContextFactory;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
+import com.intellij.openapi.vcs.roots.VcsRootDetector;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.newvfs.RefreshQueue;
import com.intellij.openapi.wm.StatusBar;
@@ -623,17 +625,21 @@ public class VcsUtil {
@NotNull
public static Collection<VcsDirectoryMapping> findRoots(@NotNull VirtualFile rootDir, @NotNull Project project)
- throws IllegalArgumentException
- {
+ throws IllegalArgumentException {
if (!rootDir.isDirectory()) {
throw new IllegalArgumentException(
"Can't find VCS at the target file system path. Reason: expected to find a directory there but it's not. The path: "
+ rootDir.getParent()
);
}
+ Collection<VcsRoot> roots = ServiceManager.getService(project, VcsRootDetector.class).detect(rootDir);
Collection<VcsDirectoryMapping> result = ContainerUtilRt.newArrayList();
- for (VcsRootFinder finder : VcsRootFinder.EP_NAME.getExtensions(project)) {
- result.addAll(finder.findRoots(rootDir));
+ for (VcsRoot vcsRoot : roots) {
+ VirtualFile vFile = vcsRoot.getPath();
+ AbstractVcs rootVcs = vcsRoot.getVcs();
+ if (rootVcs != null && vFile != null) {
+ result.add(new VcsDirectoryMapping(vFile.getPath(), rootVcs.getName()));
+ }
}
return result;
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsRootErrorImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsRootErrorImpl.java
new file mode 100644
index 000000000000..d6d3f6340840
--- /dev/null
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsRootErrorImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2000-2013 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.openapi.vcs;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Nadya Zabrodina
+ */
+public class VcsRootErrorImpl implements VcsRootError {
+
+ private final @NotNull Type myType;
+ private final @NotNull String myMapping;
+ private final @NotNull VcsKey myVcsKey;
+
+
+ public VcsRootErrorImpl(@NotNull Type type, @NotNull String mapping, @NotNull String key) {
+ myType = type;
+ myMapping = mapping;
+ myVcsKey = new VcsKey(key);
+ }
+
+ @NotNull
+ public Type getType() {
+ return myType;
+ }
+
+ @NotNull
+ public String getMapping() {
+ return myMapping;
+ }
+
+ @NotNull
+ public VcsKey getVcsKey() {
+ return myVcsKey;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("VcsRootError{%s - %s}", myType, myMapping);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ VcsRootError error = (VcsRootError)o;
+
+ if (!myMapping.equals(error.getMapping())) return false;
+ if (myType != error.getType()) return false;
+
+ return true;
+ }
+
+ @SuppressWarnings("ConstantConditions")
+ @Override
+ public int hashCode() {
+ int result = myType != null ? myType.hashCode() : 0;
+ result = 31 * result + myMapping.hashCode();
+ return result;
+ }
+} \ No newline at end of file
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectInfo.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectInfo.java
deleted file mode 100644
index eae6956f1893..000000000000
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectInfo.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.intellij.openapi.vcs.roots;
-
-import com.intellij.openapi.vcs.VcsRoot;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * @author Nadya Zabrodina
- */
-public class VcsRootDetectInfo {
-
- private final @NotNull Collection<VcsRoot> myRoots;
- private final boolean myBelow;
-
- /**
- * @param roots Vcs roots important for the project.
- * @param below Pass true to indicate that the project dir is below Vcs dir,
- */
- public VcsRootDetectInfo(@NotNull Collection<VcsRoot> roots, boolean below) {
- myRoots = new ArrayList<VcsRoot>(roots);
- myBelow = below;
- }
-
- public boolean empty() {
- return myRoots.isEmpty();
- }
-
- @NotNull
- public Collection<VcsRoot> getRoots() {
- return new ArrayList<VcsRoot>(myRoots);
- }
-
- /**
- * Below implies totally under Vcs.
- *
- * @return true if the uppermost interesting Vcs root is above the project dir,
- * false if all vcs internal directories are immediately under the project dir or deeper.
- */
- public boolean projectIsBelowVcs() {
- return myBelow;
- }
-}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectorImpl.java
index d298baaccad4..8b600cbfed73 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetector.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootDetectorImpl.java
@@ -1,3 +1,18 @@
+/*
+ * 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.openapi.vcs.roots;
import com.intellij.openapi.extensions.Extensions;
@@ -16,48 +31,49 @@ import java.util.*;
/**
* @author Nadya Zabrodina
*/
-public class VcsRootDetector {
+public class VcsRootDetectorImpl implements VcsRootDetector {
private static final int MAXIMUM_SCAN_DEPTH = 2;
@NotNull private final Project myProject;
@NotNull private final ProjectRootManager myProjectManager;
@NotNull private final ProjectLevelVcsManager myVcsManager;
+ @NotNull private final VcsRootChecker[] myCheckers;
- public VcsRootDetector(@NotNull Project project) {
+ public VcsRootDetectorImpl(@NotNull Project project,
+ @NotNull ProjectRootManager projectRootManager,
+ @NotNull ProjectLevelVcsManager projectLevelVcsManager) {
myProject = project;
- myProjectManager = ProjectRootManager.getInstance(project);
- myVcsManager = ProjectLevelVcsManager.getInstance(project);
+ myProjectManager = projectRootManager;
+ myVcsManager = projectLevelVcsManager;
+ myCheckers = Extensions.getExtensions(VcsRootChecker.EXTENSION_POINT_NAME);
}
@NotNull
- public VcsRootDetectInfo detect() {
+ public Collection<VcsRoot> detect() {
return detect(myProject.getBaseDir());
}
@NotNull
- public VcsRootDetectInfo detect(@Nullable VirtualFile startDir) {
- if (startDir == null) {
- return new VcsRootDetectInfo(Collections.<VcsRoot>emptyList(), false);
+ public Collection<VcsRoot> detect(@Nullable VirtualFile startDir) {
+ if (startDir == null || myCheckers.length == 0) {
+ return Collections.emptyList();
}
final Set<VcsRoot> roots = scanForRootsInsideDir(startDir);
roots.addAll(scanForRootsInContentRoots());
for (VcsRoot root : roots) {
if (startDir.equals(root.getPath())) {
- return new VcsRootDetectInfo(roots, false);
+ return roots;
}
}
List<VcsRoot> rootsAbove = scanForSingleRootAboveDir(startDir);
- if (!rootsAbove.isEmpty()) {
- roots.addAll(rootsAbove);
- return new VcsRootDetectInfo(roots, true);
- }
- return new VcsRootDetectInfo(roots, false);
+ roots.addAll(rootsAbove);
+ return roots;
}
@NotNull
private Set<VcsRoot> scanForRootsInContentRoots() {
- Set<VcsRoot> gitRoots = new HashSet<VcsRoot>();
+ Set<VcsRoot> vcsRoots = new HashSet<VcsRoot>();
VirtualFile[] roots = myProjectManager.getContentRoots();
for (VirtualFile contentRoot : roots) {
@@ -72,9 +88,9 @@ public class VcsRootDetector {
List<VcsRoot> rootsAbove = scanForSingleRootAboveDir(contentRoot);
rootsInsideRoot.addAll(rootsAbove);
}
- gitRoots.addAll(rootsInsideRoot);
+ vcsRoots.addAll(rootsInsideRoot);
}
- return gitRoots;
+ return vcsRoots;
}
@NotNull
@@ -126,9 +142,8 @@ public class VcsRootDetector {
@NotNull
private List<AbstractVcs> getVcsListFor(@NotNull VirtualFile dir) {
- VcsRootChecker[] checkers = Extensions.getExtensions(VcsRootChecker.EXTENSION_POINT_NAME);
List<AbstractVcs> vcsList = new ArrayList<AbstractVcs>();
- for (VcsRootChecker checker : checkers) {
+ for (VcsRootChecker checker : myCheckers) {
if (checker.isRoot(dir.getPath())) {
vcsList.add(myVcsManager.findVcsByName(checker.getSupportedVcs().getName()));
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootErrorsFinder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootErrorsFinder.java
index 0c5bcc5a4964..2769b3ca84cb 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootErrorsFinder.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootErrorsFinder.java
@@ -1,5 +1,6 @@
package com.intellij.openapi.vcs.roots;
+import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
@@ -30,7 +31,7 @@ public class VcsRootErrorsFinder {
@NotNull
public Collection<VcsRootError> find() {
List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
- Collection<VcsRoot> vcsRoots = new VcsRootDetector(myProject).detect().getRoots();
+ Collection<VcsRoot> vcsRoots = ServiceManager.getService(myProject, VcsRootDetector.class).detect();
Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
errors.addAll(findExtraMappings(mappings));
@@ -50,7 +51,7 @@ public class VcsRootErrorsFinder {
}
String vcsPath = virtualFileFromRoot.getPath();
if (!mappedPaths.contains(vcsPath) && root.getVcs() != null) {
- errors.add(new VcsRootError(VcsRootError.Type.UNREGISTERED_ROOT, vcsPath, root.getVcs().getName()));
+ errors.add(new VcsRootErrorImpl(VcsRootError.Type.UNREGISTERED_ROOT, vcsPath, root.getVcs().getName()));
}
}
return errors;
@@ -65,13 +66,13 @@ public class VcsRootErrorsFinder {
}
if (mapping.isDefaultMapping()) {
if (!isRoot(mapping)) {
- errors.add(new VcsRootError(VcsRootError.Type.EXTRA_MAPPING, VcsDirectoryMapping.PROJECT_CONSTANT, mapping.getVcs()));
+ errors.add(new VcsRootErrorImpl(VcsRootError.Type.EXTRA_MAPPING, VcsDirectoryMapping.PROJECT_CONSTANT, mapping.getVcs()));
}
}
else {
String mappedPath = mapping.systemIndependentPath();
if (!isRoot(mapping)) {
- errors.add(new VcsRootError(VcsRootError.Type.EXTRA_MAPPING, mappedPath, mapping.getVcs()));
+ errors.add(new VcsRootErrorImpl(VcsRootError.Type.EXTRA_MAPPING, mappedPath, mapping.getVcs()));
}
}
}
diff --git a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootConfiguration.java b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootConfiguration.java
new file mode 100644
index 000000000000..d3ac4b395642
--- /dev/null
+++ b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootConfiguration.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2000-2013 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.openapi.vcs.roots;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author Nadya Zabrodina
+ */
+public class VcsRootConfiguration {
+
+ @NotNull private Collection<String> myMockRoots;
+ @NotNull private Collection<String> myContentRoots;
+ @NotNull private Collection<String> myRoots;
+ @NotNull private Collection<String> myUnregErrors;
+ @NotNull private Collection<String> myExtraErrors;
+
+
+ public VcsRootConfiguration() {
+ myMockRoots = Collections.emptyList();
+ myRoots = Collections.emptyList();
+ myContentRoots = Collections.emptyList();
+ myUnregErrors = Collections.emptyList();
+ myExtraErrors = Collections.emptyList();
+ }
+
+ public VcsRootConfiguration mock(@NotNull Collection<String> mockRoots) {
+ myMockRoots = mockRoots;
+ return this;
+ }
+
+ public VcsRootConfiguration roots(@NotNull Collection<String> roots) {
+ myRoots = roots;
+ return this;
+ }
+
+ public VcsRootConfiguration contentRoots(@NotNull Collection<String> contentRoots) {
+ myContentRoots = contentRoots;
+ return this;
+ }
+
+ public VcsRootConfiguration unregErrors(@NotNull Collection<String> unregErrors) {
+ myUnregErrors = unregErrors;
+ return this;
+ }
+
+ public VcsRootConfiguration extraErrors(@NotNull Collection<String> extraErrors) {
+ myExtraErrors = extraErrors;
+ return this;
+ }
+
+ @NotNull
+ public Collection<String> getMockRoots() {
+ return myMockRoots;
+ }
+
+ @NotNull
+ public Collection<String> getContentRoots() {
+ return myContentRoots;
+ }
+
+ @NotNull
+ public Collection<String> getRoots() {
+ return myRoots;
+ }
+
+ @NotNull
+ public Collection<String> getUnregErrors() {
+ return myUnregErrors;
+ }
+
+ @NotNull
+ public Collection<String> getExtraErrors() {
+ return myExtraErrors;
+ }
+}
diff --git a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootDetectorTest.java b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootDetectorTest.java
index 8a5e862c245b..aa6238188d6b 100644
--- a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootDetectorTest.java
+++ b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootDetectorTest.java
@@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.intellij.openapi.vcs.roots;
+import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
@@ -28,7 +30,9 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import static com.intellij.openapi.vcs.Executor.cd;
import static com.intellij.openapi.vcs.Executor.mkdir;
@@ -37,138 +41,107 @@ import static com.intellij.openapi.vcs.Executor.mkdir;
/**
* @author Nadya Zabrodina
*/
+
public class VcsRootDetectorTest extends VcsRootPlatformTest {
public void testNoRootsInProject() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Collections.<String>emptyList());
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, null, Collections.<String>emptyList());
+ doTest(new VcsRootConfiguration(), null, Collections.<String>emptyList());
}
public void testProjectUnderSingleMockRoot() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("."));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myProjectRoot, Arrays.asList("."));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(".")), myProjectRoot, Arrays.asList("."));
}
public void testProjectWithMockRootUnderIt() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("community"));
- map.put("content_roots", Collections.<String>emptyList());
cd(myProjectRoot);
mkdir("src");
mkdir(".idea");
- doTest(map, myProjectRoot, Arrays.asList("community"));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList("community")), myProjectRoot, Arrays.asList("community"));
}
public void testProjectWithAllSubdirsUnderMockRootShouldStillBeNotFullyControlled() throws IOException {
String[] dirNames = {".idea", "src", "community"};
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(dirNames));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myProjectRoot, Arrays.asList(dirNames));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(dirNames)), myProjectRoot, Arrays.asList(dirNames));
}
public void testProjectUnderVcsAboveIt() throws IOException {
String subdir = "insideRepo";
cd(myRepository);
mkdir(subdir);
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(myRepository.getName()));
- map.put("content_roots", Collections.<String>emptyList());
VirtualFile vfile = myRepository.findChild(subdir);
- doTest(map, vfile, Arrays.asList(myRepository.getName())
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(myRepository.getName())), vfile, Arrays.asList(myRepository.getName())
);
}
public void testIDEAProject() throws IOException {
String[] names = {"community", "contrib", "."};
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(names));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myProjectRoot, Arrays.asList(names));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(names)), myProjectRoot, Arrays.asList(names));
}
public void testOneAboveAndOneUnder() throws IOException {
String[] names = {myRepository.getName() + "/community", "."};
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(names));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myRepository, Arrays.asList(names));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(names)), myRepository, Arrays.asList(names));
}
public void testOneAboveAndOneForProjectShouldShowOnlyProjectRoot() throws IOException {
String[] names = {myRepository.getName(), "."};
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(names));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myRepository, Arrays.asList(myRepository.getName()));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(names)), myRepository, Arrays.asList(myRepository.getName()));
}
public void testOneAboveAndSeveralUnderProject() throws IOException {
String[] names = {".", myRepository.getName() + "/community", myRepository.getName() + "/contrib"};
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(names));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myRepository, Arrays.asList(names));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(names)), myRepository, Arrays.asList(names));
}
public void testMultipleAboveShouldBeDetectedAsOneAbove() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", myRepository.getName()));
- map.put("content_roots", Collections.<String>emptyList());
String subdir = "insideRepo";
cd(myRepository);
mkdir(subdir);
VirtualFile vfile = myRepository.findChild(subdir);
- doTest(map, vfile, Arrays.asList(myRepository.getName()));
+ doTest(new VcsRootConfiguration().mock(Arrays.asList(".", myRepository.getName())), vfile, Arrays.asList(myRepository.getName()));
}
public void testUnrelatedRootShouldNotBeDetected() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("another"));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, myRepository, Collections.<String>emptyList());
+ doTest(new VcsRootConfiguration().mock(Arrays.asList("another")), myRepository, Collections.<String>emptyList());
}
public void testLinkedSourceRootAloneShouldBeDetected() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("linked_root"));
- map.put("content_roots", Arrays.asList("linked_root"));
- doTest(map, myRepository, Arrays.asList("linked_root"));
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("linked_root"))
+ .contentRoots(Arrays.asList("linked_root"));
+ doTest(vcsRootConfiguration, myRepository, Arrays.asList("linked_root"));
}
public void testLinkedSourceRootAndProjectRootShouldBeDetected() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "linked_root"));
- map.put("content_roots", Arrays.asList("linked_root"));
- doTest(map, myProjectRoot, Arrays.asList(".", "linked_root"));
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "linked_root"))
+ .contentRoots(Arrays.asList("linked_root"));
+ doTest(vcsRootConfiguration, myProjectRoot, Arrays.asList(".", "linked_root"));
}
public void testLinkedSourceBelowMockRoot() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "linked_root"));
- map.put("content_roots", Arrays.asList("linked_root/src"));
- doTest(map, myProjectRoot, Arrays.asList(".", "linked_root"));
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().contentRoots(Arrays.asList("linked_root/src"))
+ .mock(Arrays.asList(".", "linked_root"));
+ doTest(vcsRootConfiguration, myProjectRoot, Arrays.asList(".", "linked_root"));
}
// This is a test of performance optimization via limitation: don't scan deep though the whole VFS, i.e. don't detect deep roots
public void testDontScanDeeperThan2LevelsBelowAContentRoot() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("community", "content_root/lev1/lev2", "content_root2/lev1/lev2/lev3"));
- map.put("content_roots", Arrays.asList("content_root"));
- doTest(map, myProjectRoot, Arrays.asList("community", "content_root/lev1/lev2"));
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("community", "content_root/lev1/lev2", "content_root2/lev1/lev2/lev3"))
+ .contentRoots(Arrays.asList("content_root"));
+ doTest(vcsRootConfiguration,
+ myProjectRoot, Arrays.asList("community", "content_root/lev1/lev2"));
}
- void assertRoots(Collection<String> expectedRelativePaths, Collection<String> actual) {
+ void assertRoots(@NotNull Collection<String> expectedRelativePaths, @NotNull Collection<String> actual) {
VcsTestUtil.assertEqualCollections(actual, toAbsolute(expectedRelativePaths, myProject));
}
@NotNull
- public static Collection<String> toAbsolute(Collection<String> relPaths, final Project project) {
+ public static Collection<String> toAbsolute(@NotNull Collection<String> relPaths, @NotNull final Project project) {
return ContainerUtil.map(relPaths, new Function<String, String>() {
@Override
public String fun(String s) {
@@ -197,24 +170,24 @@ public class VcsRootDetectorTest extends VcsRootPlatformTest {
}
@NotNull
- private VcsRootDetectInfo detect(@Nullable VirtualFile startDir) {
- return new VcsRootDetector(myProject).detect(startDir);
+ private Collection<VcsRoot> detect(@Nullable VirtualFile startDir) {
+ return ServiceManager.getService(myProject, VcsRootDetector.class).detect(startDir);
}
- public void doTest(@NotNull Map<String, Collection<String>> map,
+ public void doTest(@NotNull VcsRootConfiguration vcsRootConfiguration,
@Nullable VirtualFile startDir,
@NotNull Collection<String> expectedPaths)
throws IOException {
- initProject(map.get("mock"), Collections.<String>emptyList(), map.get("content_roots"));
-
- VcsRootDetectInfo info = detect(startDir);
+ initProject(vcsRootConfiguration);
+ Collection<VcsRoot> vcsRoots = detect(startDir);
assertRoots(expectedPaths, getPaths(
- ContainerUtil.filter(info.getRoots(), new Condition<VcsRoot>() {
+ ContainerUtil.filter(vcsRoots, new Condition<VcsRoot>() {
@Override
public boolean value(VcsRoot root) {
assert root.getVcs() != null;
return root.getVcs().getKeyInstanceMethod().equals(myVcs.getKeyInstanceMethod());
}
- })));
+ })
+ ));
}
}
diff --git a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootErrorsFinderTest.java b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootErrorsFinderTest.java
index 80a9ce90dda1..cec34c84831b 100644
--- a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootErrorsFinderTest.java
+++ b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootErrorsFinderTest.java
@@ -18,12 +18,15 @@ package com.intellij.openapi.vcs.roots;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vcs.VcsDirectoryMapping;
import com.intellij.openapi.vcs.VcsRootError;
+import com.intellij.openapi.vcs.VcsRootErrorImpl;
import com.intellij.openapi.vcs.VcsTestUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
/**
@@ -39,187 +42,143 @@ public class VcsRootErrorsFinderTest extends VcsRootPlatformTest {
}
public void testNoRootsThenNoErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Collections.<String>emptyList());
- map.put("roots", Collections.<String>emptyList());
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, Collections.<String, Collection<String>>emptyMap());
+ doTest(new VcsRootConfiguration());
}
public void testSameOneRootInBothThenNoErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("."));
- map.put("roots", Arrays.asList("."));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, Collections.<String, Collection<String>>emptyMap());
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("."))
+ .roots(Arrays.asList("."));
+ doTest(vcsRootConfiguration);
}
public void testSameTwoRootsInBothThenNoErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "community"));
- map.put("roots", Arrays.asList(".", "community"));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, Collections.<String, Collection<String>>emptyMap());
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "community"))
+ .roots(Arrays.asList(".", "community"));
+ doTest(vcsRootConfiguration);
}
public void testOneMockRootNoVCSRootsThenError() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("."));
- map.put("roots", Collections.<String>emptyList());
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("."));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("."))
+ .unregErrors(Arrays.asList("."));
+ doTest(vcsRootConfiguration);
}
public void testOneVCSRootNoMockRootsThenError() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("roots", Arrays.asList("."));
- map.put("mock", Collections.<String>emptyList());
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("extra", Arrays.asList("."));
- doTest(map, errorsMap);
+
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().roots(Arrays.asList("."))
+ .extraErrors(Arrays.asList("."));
+ doTest(vcsRootConfiguration);
}
+
public void testOneRootButDifferentThenTwoErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("."));
- map.put("roots", Arrays.asList("community"));
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("extra", Arrays.asList("community"));
- errorsMap.put("unreg", Arrays.asList("."));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("."))
+ .roots(Arrays.asList("community"))
+ .unregErrors(Arrays.asList(".")).extraErrors(Arrays.asList("community"));
+ doTest(vcsRootConfiguration);
}
public void testTwoRootsOneMatchingOneDifferentThenTwoErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "community"));
- map.put("roots", Arrays.asList(".", "contrib"));
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("extra", Arrays.asList("contrib"));
- errorsMap.put("unreg", Arrays.asList("community"));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "community"))
+ .roots(Arrays.asList(".", "contrib"))
+ .unregErrors(Arrays.asList("community")).extraErrors(Arrays.asList("contrib"));
+ doTest(vcsRootConfiguration);
}
public void testTwoRootsInMockRootOneMatchingInVCSThenError() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "community"));
- map.put("roots", Arrays.asList("."));
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("community"));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "community"))
+ .roots(Arrays.asList("."))
+ .unregErrors(Arrays.asList("community"));
+ doTest(vcsRootConfiguration);
}
public void testTwoRootsBothNotMatchingThenFourErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "community"));
- map.put("roots", Arrays.asList("another", "contrib"));
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("extra", Arrays.asList("contrib", "another"));
- errorsMap.put("unreg", Arrays.asList("community", "."));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "community"))
+ .roots(Arrays.asList("another", "contrib"))
+ .unregErrors(Arrays.asList("community", ".")).extraErrors(Arrays.asList("contrib", "another"));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootNoMockRootsThenErrorAboutExtraRoot() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Collections.<String>emptyList());
- map.put("roots", Arrays.asList(PROJECT));
- map.put("content_roots", Collections.<String>emptyList());
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("extra", Arrays.asList(PROJECT));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration()
+ .roots(Arrays.asList(PROJECT))
+ .extraErrors(Arrays.asList(PROJECT));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootFullUnderMockRootThenCorrect() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("."));
- map.put("roots", Arrays.asList(".", PROJECT));
- map.put("content_roots", Collections.<String>emptyList());
- doTest(map, Collections.<String, Collection<String>>emptyMap());
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("."))
+ .roots(Arrays.asList(PROJECT));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootMockRootForAContentRootBelowProjectThenError() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("content_root"));
- map.put("roots", Arrays.asList(PROJECT));
- map.put("content_roots", Arrays.asList("content_root"));
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("content_root"));
- errorsMap.put("extra", Arrays.asList(PROJECT));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("content_root"))
+ .contentRoots(Arrays.asList("content_root")).roots(Arrays.asList(PROJECT))
+ .unregErrors(Arrays.asList("content_root")).extraErrors(Arrays.asList(PROJECT));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootMockRootBelowProjectFolderNotInAContentRootThenUnregisteredRootError() throws IOException {
// this is to be fixed: auto-detection of MockRoot repositories in subfolders for the <Project> mapping
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList("community"));
- map.put("roots", Arrays.asList(PROJECT));
- map.put("content_roots", Arrays.asList("."));
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("community"));
- errorsMap.put("extra", Arrays.asList(PROJECT));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList("community"))
+ .contentRoots(Arrays.asList(".")).roots(Arrays.asList(PROJECT))
+ .unregErrors(Arrays.asList("community")).extraErrors(Arrays.asList(PROJECT));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootMockRootForFullProjectContentRootLinkedSourceFolderBelowProjectThenErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "content_root", "../linked_source_root", "folder"));
- map.put("roots", Arrays.asList(PROJECT));
- map.put("content_roots", Arrays.asList(".", "content_root", "../linked_source_root"));
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("content_root", "../linked_source_root", "folder"));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "content_root", "../linked_source_root", "folder"))
+ .roots(Arrays.asList(PROJECT))
+ .contentRoots(Arrays.asList(".", "content_root", "../linked_source_root"))
+ .unregErrors(Arrays.asList("content_root", "../linked_source_root", "folder"));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootForFolderMockRootForFullProjectContentRootLinkedSourceFolderBelowProjectThenErrors() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "content_root", "../linked_source_root", "folder"));
- map.put("roots", Arrays.asList(PROJECT, "folder"));
- map.put("content_roots", Arrays.asList(".", "content_root", "../linked_source_root"));
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("content_root", "../linked_source_root"));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "content_root", "../linked_source_root", "folder"))
+ .roots(Arrays.asList(PROJECT, "folder"))
+ .contentRoots(Arrays.asList(".", "content_root", "../linked_source_root"))
+ .unregErrors(Arrays.asList("content_root", "../linked_source_root"));
+ doTest(vcsRootConfiguration);
}
public void testProjectRootMockRootLikeInIDEAProjectThenError() throws IOException {
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "community", "contrib"));
- map.put("roots", Arrays.asList(PROJECT));
- map.put("content_roots", Arrays.asList(".", "community", "contrib"));
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("community", "contrib"));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "community", "contrib")).roots(Arrays.asList(PROJECT))
+ .contentRoots(Arrays.asList(".", "community", "contrib")).unregErrors(Arrays.asList("community", "contrib"));
+ doTest(vcsRootConfiguration);
}
public void testRealMockRootRootDeeperThanThreeLevelsShouldBeDetected() throws IOException {
-
- Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
- map.put("mock", Arrays.asList(".", "community", "contrib", "community/level1/level2/level3"));
- map.put("roots", Arrays.asList(PROJECT, "community/level1/level2/level3"));
- map.put("content_roots", Arrays.asList(".", "community", "contrib"));
- Map<String, Collection<String>> errorsMap = new HashMap<String, Collection<String>>();
- errorsMap.put("unreg", Arrays.asList("community", "contrib"));
- doTest(map, errorsMap);
+ VcsRootConfiguration vcsRootConfiguration =
+ new VcsRootConfiguration().mock(Arrays.asList(".", "community", "contrib", "community/level1/level2/level3"))
+ .contentRoots(Arrays.asList(".", "community", "contrib")).roots(Arrays.asList(PROJECT, "community/level1/level2/level3"))
+ .unregErrors(Arrays.asList("community", "contrib"));
+ doTest(vcsRootConfiguration);
}
- private void doTest(@NotNull Map<String, Collection<String>> map, @NotNull Map<String, Collection<String>> errors) throws IOException {
- initProject(map.get("mock"), Collections.<String>emptyList(), map.get("content_roots"));
- addVcsRoots(map.get("roots"));
+ private void doTest(@NotNull VcsRootConfiguration vcsRootConfiguration) throws IOException {
+ initProject(vcsRootConfiguration);
+ addVcsRoots(vcsRootConfiguration.getRoots());
Collection<VcsRootError> expected = new ArrayList<VcsRootError>();
- Collection<String> unregPaths = errors.get("unreg");
- Collection<String> extraPaths = errors.get("extra");
- if (unregPaths != null) {
- expected.addAll(unregAll(unregPaths));
- }
- if (extraPaths != null) {
- expected.addAll(extraAll(extraPaths));
- }
+ expected.addAll(unregAll(vcsRootConfiguration.getUnregErrors()));
+ expected.addAll(extraAll(vcsRootConfiguration.getExtraErrors()));
Collection<VcsRootError> actual = ContainerUtil.filter(new VcsRootErrorsFinder(myProject).find(), new Condition<VcsRootError>() {
@Override
public boolean value(VcsRootError error) {
@@ -261,12 +220,12 @@ public class VcsRootErrorsFinderTest extends VcsRootPlatformTest {
@NotNull
VcsRootError unreg(@NotNull String path) {
- return new VcsRootError(VcsRootError.Type.UNREGISTERED_ROOT, VcsTestUtil.toAbsolute(path, myProject), myVcsName);
+ return new VcsRootErrorImpl(VcsRootError.Type.UNREGISTERED_ROOT, VcsTestUtil.toAbsolute(path, myProject), myVcsName);
}
@NotNull
VcsRootError extra(@NotNull String path) {
- return new VcsRootError(VcsRootError.Type.EXTRA_MAPPING, PROJECT.equals(path) ? PROJECT : VcsTestUtil.toAbsolute(path, myProject),
- myVcsName);
+ return new VcsRootErrorImpl(VcsRootError.Type.EXTRA_MAPPING, PROJECT.equals(path) ? PROJECT : VcsTestUtil.toAbsolute(path, myProject),
+ myVcsName);
}
}
diff --git a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootPlatformTest.java b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootPlatformTest.java
index 5bf81646a4fd..407903b98c14 100644
--- a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootPlatformTest.java
+++ b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/roots/VcsRootPlatformTest.java
@@ -141,12 +141,10 @@ public abstract class VcsRootPlatformTest extends UsefulTestCase {
*
* @param mockRoots path to actual .mock roots, relative to the project dir.
*/
- public void initProject(@NotNull Collection<String> mockRoots,
- @NotNull Collection<String> projectStructure,
- @NotNull Collection<String> contentRoots)
+ public void initProject(@NotNull VcsRootConfiguration vcsRootConfiguration)
throws IOException {
- createDirs(mockRoots);
- createProjectStructure(myProject, projectStructure);
+ createDirs(vcsRootConfiguration.getMockRoots());
+ Collection<String> contentRoots = vcsRootConfiguration.getContentRoots();
createProjectStructure(myProject, contentRoots);
if (!contentRoots.isEmpty()) {
for (String root : contentRoots) {
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogMultiRepoJoiner.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogMultiRepoJoiner.java
index d0f47ec014a7..3bcd2476b575 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogMultiRepoJoiner.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogMultiRepoJoiner.java
@@ -43,10 +43,10 @@ class VcsLogMultiRepoJoiner {
@NotNull
private static TimedVcsCommit findLatestCommit(@NotNull Set<TimedVcsCommit> commits) {
- long maxTimeStamp = 0;
+ long maxTimeStamp = Long.MIN_VALUE;
TimedVcsCommit lastCommit = null;
for (TimedVcsCommit commit : commits) {
- if (commit.getTime() > maxTimeStamp) {
+ if (commit.getTime() >= maxTimeStamp) {
maxTimeStamp = commit.getTime();
lastCommit = commit;
}