From a632bbd48501bf839714d0e980c7e02a81f96013 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 28 Oct 2013 16:28:52 +0400 Subject: [PATCH 01/43] Use constants for names of the 'numbers' classes --- python/psi-api/src/com/jetbrains/python/PyNames.java | 12 +++++++----- .../com/jetbrains/python/psi/types/PyABCUtil.java | 6 +++--- .../jetbrains/python/psi/types/PyTypeChecker.java | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/python/psi-api/src/com/jetbrains/python/PyNames.java b/python/psi-api/src/com/jetbrains/python/PyNames.java index 61e17e1ead28..e93a12099cdb 100644 --- a/python/psi-api/src/com/jetbrains/python/PyNames.java +++ b/python/psi-api/src/com/jetbrains/python/PyNames.java @@ -106,10 +106,11 @@ public class PyNames { public static final String SEQUENCE = "Sequence"; public static final String MAPPING = "Mapping"; - public static final String COMPLEX = "Complex"; - public static final String REAL = "Real"; - public static final String RATIONAL = "Rational"; - public static final String INTEGRAL = "Integral"; + public static final String ABC_NUMBER = "Number"; + public static final String ABC_COMPLEX = "Complex"; + public static final String ABC_REAL = "Real"; + public static final String ABC_RATIONAL = "Rational"; + public static final String ABC_INTEGRAL = "Integral"; public static final String CONTAINS = "__contains__"; public static final String HASH = "__hash__"; @@ -386,7 +387,8 @@ public class PyNames { ); public static Set BuiltinInterfaces = ImmutableSet.of( - CALLABLE, HASHABLE, ITERABLE, ITERATOR, SIZED, CONTAINER, SEQUENCE, MAPPING, COMPLEX, REAL, RATIONAL, INTEGRAL + CALLABLE, HASHABLE, ITERABLE, ITERATOR, SIZED, CONTAINER, SEQUENCE, MAPPING, ABC_COMPLEX, ABC_REAL, ABC_RATIONAL, ABC_INTEGRAL, + ABC_NUMBER ); /** diff --git a/python/src/com/jetbrains/python/psi/types/PyABCUtil.java b/python/src/com/jetbrains/python/psi/types/PyABCUtil.java index 5ab41d9f25f4..3dc72a765646 100644 --- a/python/src/com/jetbrains/python/psi/types/PyABCUtil.java +++ b/python/src/com/jetbrains/python/psi/types/PyABCUtil.java @@ -68,13 +68,13 @@ public class PyABCUtil { if (PyNames.MAPPING.equals(superClassName)) { return isSized && hasIter && isContainer && hasGetItem && hasMethod(subClass, PyNames.KEYS, inherited); } - if (PyNames.COMPLEX.equals(superClassName)) { + if (PyNames.ABC_COMPLEX.equals(superClassName)) { return hasMethod(subClass, "__complex__", inherited); } - if (PyNames.REAL.equals(superClassName)) { + if (PyNames.ABC_REAL.equals(superClassName)) { return hasMethod(subClass, "__float__", inherited); } - if (PyNames.INTEGRAL.equals(superClassName)) { + if (PyNames.ABC_INTEGRAL.equals(superClassName)) { return hasMethod(subClass, "__int__", inherited); } return false; diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java index 4b73781a00fc..5ba88b8ecbb0 100644 --- a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java +++ b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java @@ -193,10 +193,10 @@ public class PyTypeChecker { if (superName == null || subName == null || superName.equals(subName) || ("int".equals(superName) && subIsBool) || - (("long".equals(superName) || "Integral".equals(superName)) && (subIsBool || subIsInt)) || - (("float".equals(superName) || "Real".equals(superName)) && (subIsBool || subIsInt || subIsLong)) || - (("complex".equals(superName) || "Complex".equals(superName)) && (subIsBool || subIsInt || subIsLong || subIsFloat)) || - ("Number".equals(superName) && (subIsBool || subIsInt || subIsLong || subIsFloat || subIsComplex))) { + (("long".equals(superName) || PyNames.ABC_INTEGRAL.equals(superName)) && (subIsBool || subIsInt)) || + (("float".equals(superName) || PyNames.ABC_REAL.equals(superName)) && (subIsBool || subIsInt || subIsLong)) || + (("complex".equals(superName) || PyNames.ABC_COMPLEX.equals(superName)) && (subIsBool || subIsInt || subIsLong || subIsFloat)) || + (PyNames.ABC_NUMBER.equals(superName) && (subIsBool || subIsInt || subIsLong || subIsFloat || subIsComplex))) { return true; } return false; From 4f00f3fbc9d05f24040d853f9cf840886634d85a Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 28 Oct 2013 16:39:58 +0400 Subject: [PATCH 02/43] Decimal is a subclass of numbers.Number --- python/src/com/jetbrains/python/psi/types/PyABCUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/src/com/jetbrains/python/psi/types/PyABCUtil.java b/python/src/com/jetbrains/python/psi/types/PyABCUtil.java index 3dc72a765646..faf10ba1dc21 100644 --- a/python/src/com/jetbrains/python/psi/types/PyABCUtil.java +++ b/python/src/com/jetbrains/python/psi/types/PyABCUtil.java @@ -77,6 +77,9 @@ public class PyABCUtil { if (PyNames.ABC_INTEGRAL.equals(superClassName)) { return hasMethod(subClass, "__int__", inherited); } + if (PyNames.ABC_NUMBER.equals(superClassName) && "Decimal".equals(subClass.getName())) { + return true; + } return false; } From f99d0ecbeb6283f67a159d7aa3c618f2af789096 Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 29 Oct 2013 10:48:36 +0400 Subject: [PATCH 03/43] Cloud Bees: show application URL in console when application is deployed --- .../intellij/remoteServer/runtime/log/LoggingHandler.java | 1 + .../remoteServer/impl/runtime/log/LoggingHandlerImpl.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/log/LoggingHandler.java b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/log/LoggingHandler.java index 65d319f0e335..a04268795869 100644 --- a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/log/LoggingHandler.java +++ b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/log/LoggingHandler.java @@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull; */ public interface LoggingHandler { void print(@NotNull String s); + void printHyperlink(@NotNull String url); void attachToProcess(@NotNull ProcessHandler handler); } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/log/LoggingHandlerImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/log/LoggingHandlerImpl.java index caa64f933d51..8189a3c132d0 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/log/LoggingHandlerImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/log/LoggingHandlerImpl.java @@ -1,5 +1,6 @@ package com.intellij.remoteServer.impl.runtime.log; +import com.intellij.execution.filters.BrowserHyperlinkInfo; import com.intellij.execution.filters.TextConsoleBuilderFactory; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.ui.ConsoleView; @@ -28,6 +29,11 @@ public class LoggingHandlerImpl implements LoggingHandler { myConsole.print(s, ConsoleViewContentType.NORMAL_OUTPUT); } + @Override + public void printHyperlink(@NotNull String url) { + myConsole.printHyperlink(url, new BrowserHyperlinkInfo(url)); + } + public void printlnSystemMessage(@NotNull String s) { myConsole.print(s + "\n", ConsoleViewContentType.SYSTEM_OUTPUT); } From 7c26cf84429f86e5608be53082e0aa5f86b5c929 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Tue, 29 Oct 2013 11:48:13 +0400 Subject: [PATCH 04/43] Revert API changes --- .../ExtendWordSelectionHandler.java | 18 ------------------ .../ExtendWordSelectionHandlerBase.java | 16 +++++++++++++++- .../editorActions/SelectWordUtil.java | 4 +++- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/platform/lang-api/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandler.java b/platform/lang-api/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandler.java index d190324c7078..54b1396560ac 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandler.java +++ b/platform/lang-api/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandler.java @@ -20,7 +20,6 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.NotNull; import java.util.List; @@ -30,21 +29,4 @@ public interface ExtendWordSelectionHandler { boolean canSelect(PsiElement e); List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor); - - /** - * Returns minimal selection length for given element. - * - * Sometimes the length of word selection should be bounded below. - * E.g. it is useful in languages that requires prefixes for variable (php, less, etc.). - * By default this kind of variables will be selected without prefix: @variable, - * but it make sense to exclude this range from selection list. - * So if this method returns 9 as a minimal length of selection - * then first selection range for @variable will be: @variable. - * - * @param element element at caret - * @param text text in editor - * @param cursorOffset current caret offset in editor - * @return minimal selection length for given element - */ - int getMinimalTextRangeLength(@NotNull PsiElement element, @NotNull CharSequence text, int cursorOffset); } \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java index e106e955b069..439f73c52a98 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java @@ -51,7 +51,21 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect return ranges; } - @Override + /** + * Returns minimal selection length for given element. + * + * Sometimes the length of word selection should be bounded below. + * E.g. it is useful in languages that requires prefixes for variable (php, less, etc.). + * By default this kind of variables will be selected without prefix: @variable, + * but it make sense to exclude this range from selection list. + * So if this method returns 9 as a minimal length of selection + * then first selection range for @variable will be: @variable. + * + * @param element element at caret + * @param text text in editor + * @param cursorOffset current caret offset in editor + * @return minimal selection length for given element + */ public int getMinimalTextRangeLength(@NotNull PsiElement element, @NotNull CharSequence text, int cursorOffset) { return 0; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java index 09561435eda3..07923f11d5c5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java @@ -211,7 +211,9 @@ public class SelectWordUtil { List availableSelectioners = ContainerUtil.newLinkedList(); for (ExtendWordSelectionHandler selectioner : extendWordSelectionHandlers) { if (selectioner.canSelect(element)) { - int selectionerMinimalTextRange = selectioner.getMinimalTextRangeLength(element, text, cursorOffset); + int selectionerMinimalTextRange = selectioner instanceof ExtendWordSelectionHandlerBase + ? ((ExtendWordSelectionHandlerBase)selectioner).getMinimalTextRangeLength(element, text, cursorOffset) + : 0; minimalTextRangeLength = Math.max(minimalTextRangeLength, selectionerMinimalTextRange); availableSelectioners.add(selectioner); } From 7f3c7674f49825610cf3e5b9aab4cfcf2a937e23 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 29 Oct 2013 12:10:53 +0400 Subject: [PATCH 05/43] IDEA-115541 'Navigate to class' is opened after Enter if nothing was found in 'Search Everywhere'. --- .../ide/actions/SearchEverywhereAction.java | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 389dbbf97992..527355c5e7ae 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -372,30 +372,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA onFocusLost(); } }); - - editor.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - switch (e.getKeyCode()) { - case KeyEvent.VK_ESCAPE: - if (myBalloon != null && myBalloon.isVisible()) { - myBalloon.cancel(); - } - if (myPopup != null && myPopup.isVisible()) { - myPopup.cancel(); - } - IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(editor); - focusManager.requestDefaultFocus(true); - break; - case KeyEvent.VK_ENTER: - doNavigate(myList.getSelectedIndex()); - break; - case KeyEvent.VK_TAB: - jumpNextGroup(!e.isShiftDown()); - break; - } - } - }); } private void jumpNextGroup(boolean forward) { @@ -605,18 +581,39 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } private void initSearchActions(JBPopup balloon, MySearchTextField searchTextField) { + final JTextField editor = searchTextField.getTextEditor(); new AnAction(){ @Override public void actionPerformed(AnActionEvent e) { jumpNextGroup(true); } - }.registerCustomShortcutSet(CustomShortcutSet.fromString("TAB"), searchTextField.getTextEditor(), balloon); + }.registerCustomShortcutSet(CustomShortcutSet.fromString("TAB"), editor, balloon); new AnAction(){ @Override public void actionPerformed(AnActionEvent e) { jumpNextGroup(false); } - }.registerCustomShortcutSet(CustomShortcutSet.fromString("shift TAB"), searchTextField.getTextEditor(), balloon); + }.registerCustomShortcutSet(CustomShortcutSet.fromString("shift TAB"), editor, balloon); + new AnAction(){ + @Override + public void actionPerformed(AnActionEvent e) { + if (myBalloon != null && myBalloon.isVisible()) { + myBalloon.cancel(); + } + if (myPopup != null && myPopup.isVisible()) { + myPopup.cancel(); + } + } + }.registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), editor, balloon); + new AnAction(){ + @Override + public void actionPerformed(AnActionEvent e) { + final int index = myList.getSelectedIndex(); + if (index != -1) { + doNavigate(index); + } + } + }.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), editor, balloon); } private static class MySearchTextField extends SearchTextField implements DataProvider, Disposable { From d2af65cbc14b195f2c7985906f4a73044fa968c9 Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 29 Oct 2013 12:10:43 +0400 Subject: [PATCH 06/43] simplification: processing and removing excluded folders --- .../project/manage/ContentRootDataService.java | 7 +------ .../roots/ui/configuration/ContentEntryEditor.java | 10 ++-------- .../configuration/ContentEntryTreeCellRenderer.java | 6 ++---- .../roots/ui/configuration/ContentRootPanel.java | 13 +++---------- .../com/intellij/openapi/roots/ContentEntry.java | 7 +++++++ .../openapi/roots/impl/ContentEntryImpl.java | 12 ++++++++++++ .../model/impl/module/content/JpsContentEntry.java | 13 +++++++++++++ .../src/com/intellij/testFramework/PsiTestUtil.java | 6 +----- .../idea/maven/importing/MavenRootModelAdapter.java | 6 ++---- 9 files changed, 43 insertions(+), 37 deletions(-) diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java index 13965b1f0c7c..d9eec89d63f2 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java @@ -167,12 +167,7 @@ public class ContentRootDataService implements ProjectDataService toRemove = new ArrayList(); diff --git a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java index 794da9486b09..9115d7992825 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java @@ -236,11 +236,7 @@ public class PsiTestUtil { @Override public void consume(ModifiableRootModel model) { ContentEntry entry = findContentEntryWithAssertion(model, root); - for (ExcludeFolder excludeFolder : entry.getExcludeFolders()) { - if (root.equals(excludeFolder.getFile())) { - entry.removeExcludeFolder(excludeFolder); - } - } + entry.removeExcludeFolder(root.getUrl()); } }); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java index 168b55d9ff8d..7a20e616fddc 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java @@ -171,10 +171,8 @@ public class MavenRootModelAdapter { public boolean isAlreadyExcluded(File f) { String url = toUrl(f.getPath()).getUrl(); - for (ContentEntry eachEntry : myRootModel.getContentEntries()) { - for (ExcludeFolder eachFolder : eachEntry.getExcludeFolders()) { - if (VfsUtilCore.isEqualOrAncestor(eachFolder.getUrl(), url)) return true; - } + for (String excludedUrl : myRootModel.getExcludeRootUrls()) { + if (VfsUtilCore.isEqualOrAncestor(excludedUrl, url)) return true; } return false; } From 9aabdfa2d1f511a1b503e53cb261b61302df0508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Tue, 29 Oct 2013 10:01:28 +0100 Subject: [PATCH 07/43] fix test mem leak? --- .../com/intellij/ui/FinderRecursivePanelTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelTest.java b/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelTest.java index 207346b1868c..6fc5f21f49e4 100644 --- a/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelTest.java @@ -15,7 +15,7 @@ */ package com.intellij.ui; -import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.project.Project; import com.intellij.testFramework.PlatformTestCase; import com.intellij.ui.components.JBList; import org.jetbrains.annotations.NotNull; @@ -86,7 +86,7 @@ public class FinderRecursivePanelTest extends PlatformTestCase { } public void testUpdate() throws InterruptedException { - StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel() { + StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject()) { @NotNull @Override protected JComponent createRightComponent(String s) { @@ -105,7 +105,8 @@ public class FinderRecursivePanelTest extends PlatformTestCase { }; } }; - Disposer.register(myTestRootDisposable, panel_0); + disposeOnTearDown(panel_0); + panel_0.setTestSelectedIndex(0); //panel_0.updateRightComponent(true); @@ -131,8 +132,8 @@ public class FinderRecursivePanelTest extends PlatformTestCase { private JBList myList; - private StringFinderRecursivePanel() { - super(FinderRecursivePanelTest.this.myProject, "fooPanel"); + private StringFinderRecursivePanel(Project project) { + super(project, "fooPanel"); init(); } From 053d812606700dcf66cc8819e49275075ed2ae0a Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Tue, 29 Oct 2013 13:07:25 +0400 Subject: [PATCH 08/43] WEB-9778 Strange bug on Emmet when using curly braces --- .../codeInsight/template/emmet/XmlEmmetParser.java | 3 +++ .../template/emmet/nodes/GenerationNode.java | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java index 0dd6ae7c7715..69350db5ea8e 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java @@ -100,6 +100,9 @@ public class XmlEmmetParser extends EmmetParser { final String text = ((StringLiteralToken)token).getText(); return text.substring(1, text.length() - 1); } + else if (token instanceof TextToken) { + return ((TextToken)token).getText(); + } else if (token instanceof IdentifierToken) { return ((IdentifierToken)token).getText(); } diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java index 3c8d40eb9e5b..1d5be9d5a471 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java @@ -279,10 +279,10 @@ public class GenerationNode extends UserDataHolderBase { if (tag != null) { for (Pair pair : attr2value) { if (Strings.isNullOrEmpty(pair.second)) { - template.addVariable(pair.first, "", "", true); + template.addVariable(prepareVariableName(pair.first), "", "", true); } } - XmlTag tag1 = hasChildren ? expandEmptyTagIfNeccessary(tag) : tag; + XmlTag tag1 = hasChildren ? expandEmptyTagIfNecessary(tag) : tag; setAttributeValues(tag1, attr2value); XmlFile physicalFile = (XmlFile)fileFactory.createFileFromText("dummy.xml", StdFileTypes.XML, tag1.getContainingFile().getText(), LocalTimeCounter.currentTime(), true); @@ -298,6 +298,10 @@ public class GenerationNode extends UserDataHolderBase { return template; } + private static String prepareVariableName(@NotNull String attributeName) { + return StringUtil.replaceChar(attributeName, '-', '_'); + } + @NotNull private static TemplateImpl expandTemplate(@NotNull TemplateImpl template, Map predefinedVarValues, @@ -317,7 +321,7 @@ public class GenerationNode extends UserDataHolderBase { } @NotNull - private static XmlTag expandEmptyTagIfNeccessary(@NotNull XmlTag tag) { + private static XmlTag expandEmptyTagIfNecessary(@NotNull XmlTag tag) { StringBuilder builder = new StringBuilder(); boolean flag = false; @@ -411,7 +415,7 @@ public class GenerationNode extends UserDataHolderBase { } tag.setAttribute(pair.first, Strings.isNullOrEmpty(pair.second) - ? "$" + pair.first + "$" + ? "$" + prepareVariableName(pair.first) + "$" : ZenCodingUtil.getValue(pair.second, myNumberInIteration, myTotalIterations, mySurroundedText)); iterator.remove(); } From d88d171aeb577ac539ff310d24cb31d03d3c51d1 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Tue, 29 Oct 2013 13:26:12 +0400 Subject: [PATCH 09/43] support line-separated editing #WEB-2407 fixed --- .../HtmlUnknownTagInspection.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownTagInspection.java b/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownTagInspection.java index e5ddc3d8fa73..92b3bf907b7b 100644 --- a/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownTagInspection.java +++ b/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownTagInspection.java @@ -16,8 +16,13 @@ package com.intellij.codeInspection.htmlInspections; +import com.intellij.openapi.ui.Messages; +import com.intellij.openapi.util.Ref; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.FieldPanel; +import com.intellij.util.Function; +import com.intellij.util.PlatformIcons; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,6 +34,7 @@ import javax.swing.text.Document; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.List; /** * @author spleaner @@ -56,7 +62,27 @@ public class HtmlUnknownTagInspection extends HtmlUnknownTagInspectionBase { final JPanel internalPanel = new JPanel(new BorderLayout()); result.add(internalPanel, BorderLayout.NORTH); - final FieldPanel additionalAttributesPanel = new FieldPanel(null, inspection.getPanelTitle(), null, null); + final Ref panelRef = new Ref(); + final FieldPanel additionalAttributesPanel = new FieldPanel(null, null, new ActionListener() { + @Override + public void actionPerformed(ActionEvent event) { + Messages.showTextAreaDialog(panelRef.get().getTextField(), inspection.getPanelTitle(), "HtmlUnknownTagInspection", + new Function>() { + @Override + public List fun(String s) { + return reparseProperties(s); + } + }, new Function, String>() { + @Override + public String fun(List strings) { + return StringUtil.join(strings, ","); + } + } + ); + } + }, null); + ((JButton)additionalAttributesPanel.getComponent(1)).setIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON); + panelRef.set(additionalAttributesPanel); additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { From 4bc1556d2b95d50862045883cf1d2b893cc0bbfa Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 29 Oct 2013 13:47:54 +0400 Subject: [PATCH 10/43] fixing tests --- .../fixtures/CodeInsightTestFixture.java | 4 ++++ .../fixtures/impl/CodeInsightTestFixtureImpl.java | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java index 1ee830e8281e..da04e8f5f97b 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java @@ -27,6 +27,7 @@ import com.intellij.codeInspection.InspectionToolProvider; import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.ex.InspectionToolWrapper; import com.intellij.ide.structureView.newStructureView.StructureViewComponent; +import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.editor.Document; @@ -285,6 +286,9 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture { @NotNull List doHighlighting(); + @NotNull + List doHighlighting(HighlightSeverity minimalSeverity); + /** * Finds the reference in position marked by {@link #CARET_MARKER}. * diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 733aeafd7bb4..23ae57fd5bcf 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -51,6 +51,7 @@ import com.intellij.injected.editor.DocumentWindow; import com.intellij.injected.editor.EditorWindow; import com.intellij.internal.DumpLookupElementWeights; import com.intellij.lang.LanguageStructureViewBuilder; +import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ActionManagerEx; @@ -1491,6 +1492,17 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return instantiateAndRun(file, editor, ArrayUtil.EMPTY_INT_ARRAY, myAllowDirt); } + @NotNull + @Override + public List doHighlighting(final HighlightSeverity minimalSeverity) { + return ContainerUtil.filter(doHighlighting(), new Condition() { + @Override + public boolean value(HighlightInfo info) { + return info.getSeverity().compareTo(minimalSeverity) >= 0; + } + }); + } + @NotNull public static List instantiateAndRun(@NotNull PsiFile file, @NotNull Editor editor, From 9ac6c975e5f00b45ff49b2fe90bb98c35216b7a2 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 29 Oct 2013 15:28:01 +0400 Subject: [PATCH 11/43] allow to change gap between popups --- .../ui/popup/PopupPositionManager.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java b/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java index f9a43f960019..e024091cd172 100644 --- a/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java +++ b/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java @@ -135,33 +135,38 @@ public class PopupPositionManager { } public static class PositionAdjuster { - private static final int GAP = 5; + private final int myGap; private final Component myRelativeTo; private final Point myRelativeOnScreen; private final Rectangle myScreenRect; - public PositionAdjuster(final Component relativeTo) { + public PositionAdjuster(final Component relativeTo, int gap) { myRelativeTo = relativeTo; myRelativeOnScreen = relativeTo.getLocationOnScreen(); myScreenRect = ScreenUtil.getScreenRectangle(myRelativeOnScreen); + myGap = gap; + } + + public PositionAdjuster(final Component relativeTo) { + this(relativeTo, 5); } protected Rectangle positionRight(final Dimension d) { - return new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + GAP, myRelativeOnScreen.y, d.width, + return new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + myGap, myRelativeOnScreen.y, d.width, d.height); } protected Rectangle positionLeft(final Dimension d) { - return new Rectangle(myRelativeOnScreen.x - GAP - d.width, myRelativeOnScreen.y, d.width, d.height); + return new Rectangle(myRelativeOnScreen.x - myGap - d.width, myRelativeOnScreen.y, d.width, d.height); } protected Rectangle positionAbove(final Dimension d) { - return new Rectangle(myRelativeOnScreen.x, getYForTopPositioning() - GAP - d.height, d.width, d.height); + return new Rectangle(myRelativeOnScreen.x, getYForTopPositioning() - myGap - d.height, d.width, d.height); } protected Rectangle positionUnder(final Dimension d) { - return new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + GAP + myRelativeTo.getHeight(), d.width, d.height); + return new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myGap + myRelativeTo.getHeight(), d.width, d.height); } protected int getYForTopPositioning() { @@ -213,19 +218,19 @@ public class PopupPositionManager { // ok, popup does not fit, will try to resize it final java.util.List boxes = new ArrayList(); // right - boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + GAP, myRelativeOnScreen.y, + boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + myGap, myRelativeOnScreen.y, myScreenRect.width, myScreenRect.height))); // left - boxes.add(crop(myScreenRect, new Rectangle(myScreenRect.x, myRelativeOnScreen.y, myRelativeOnScreen.x - myScreenRect.x - GAP, + boxes.add(crop(myScreenRect, new Rectangle(myScreenRect.x, myRelativeOnScreen.y, myRelativeOnScreen.x - myScreenRect.x - myGap, myScreenRect.height))); // top boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x, myScreenRect.y, - myScreenRect.width, getYForTopPositioning() - myScreenRect.y - GAP))); + myScreenRect.width, getYForTopPositioning() - myScreenRect.y - myGap))); // bottom - boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myRelativeTo.getHeight() + GAP, + boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myRelativeTo.getHeight() + myGap, myScreenRect.width, myScreenRect.height))); Collections.sort(boxes, new Comparator() { From 54a9e143f268b7f76161bd45288a6e93da1f2836 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 29 Oct 2013 15:30:51 +0400 Subject: [PATCH 12/43] adjust popup according to screen size --- .../ide/actions/SearchEverywhereAction.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 527355c5e7ae..9f81d26ab6ef 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -21,6 +21,7 @@ import com.intellij.ide.DataManager; import com.intellij.ide.IdeEventQueue; import com.intellij.ide.IdeTooltipManager; import com.intellij.ide.SearchTopHitProvider; +import com.intellij.ide.ui.UISettings; import com.intellij.ide.ui.search.BooleanOptionDescription; import com.intellij.ide.ui.search.OptionDescription; import com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl; @@ -58,6 +59,7 @@ import com.intellij.openapi.vfs.VirtualFilePathWrapper; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.WindowManager; +import com.intellij.openapi.wm.impl.IdeFrameImpl; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; @@ -74,6 +76,7 @@ import com.intellij.ui.components.JBList; import com.intellij.ui.components.JBScrollPane; import com.intellij.ui.components.OnOffButton; import com.intellij.ui.popup.AbstractPopup; +import com.intellij.ui.popup.PopupPositionManager; import com.intellij.util.*; import com.intellij.util.indexing.FindSymbolParameters; import com.intellij.util.ui.EmptyIcon; @@ -568,7 +571,11 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA showPoint = new RelativePoint(button, new Point(button.getWidth() - panel.getPreferredSize().width, button.getHeight())); } else { if (parent != null) { - showPoint = new RelativePoint(parent, new Point((parent.getSize().width - panel.getPreferredSize().width)/ 2, parent.getHeight()/4)); + int height = UISettings.getInstance().SHOW_MAIN_TOOLBAR ? 95 : 75; + if (parent instanceof IdeFrameImpl && ((IdeFrameImpl)parent).isInFullScreen()) { + height -= 20; + } + showPoint = new RelativePoint(parent, new Point((parent.getSize().width - panel.getPreferredSize().width)/ 2, height)); } else { showPoint = JBPopupFactory.getInstance().guessBestPopupLocation(e.getDataContext()); } @@ -1459,15 +1466,15 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA return; } final Container parent = getField().getParent(); - final Dimension size = myList.getPreferredSize(); + final Dimension size = myList.getParent().getParent().getPreferredSize(); if (size.width < parent.getWidth()) { size.width = parent.getWidth(); } if (myList.getItemsCount() == 0) { size.height = 70; } - Dimension sz = new Dimension(size.width, size.height); - if (sz.width > 1000 || sz.height > 800) { + Dimension sz = new Dimension(size.width, myList.getPreferredSize().height); + if (sz.width > 1200 || sz.height > 800) { final JBScrollPane pane = new JBScrollPane(); final int extraWidth = pane.getVerticalScrollBar().getWidth() + 1; final int extraHeight = pane.getHorizontalScrollBar().getHeight() + 1; @@ -1494,7 +1501,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } private void adjustPopup() { -// new PopupPositionManager.PositionAdjuster(getField().getParent()).adjust(myPopup, BOTTOM, RIGHT, LEFT, TOP); + new PopupPositionManager.PositionAdjuster(getField().getParent(), 0).adjust(myPopup, PopupPositionManager.Position.BOTTOM); } private static boolean isToolWindowAction(Object o) { From fcc533cc8eb7139ac7a4b6de503c5d0b00f1d6e3 Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 29 Oct 2013 15:33:06 +0400 Subject: [PATCH 13/43] added sources for asm4 to community project --- .idea/libraries/asm4.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.idea/libraries/asm4.xml b/.idea/libraries/asm4.xml index c6676c49b88e..5fa4ef1ddb66 100644 --- a/.idea/libraries/asm4.xml +++ b/.idea/libraries/asm4.xml @@ -4,6 +4,8 @@ - + + + \ No newline at end of file From 989d844fb681edeb1f3060a796e2ab3308b72134 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 29 Oct 2013 15:38:31 +0400 Subject: [PATCH 14/43] make selected group always visible --- .../com/intellij/ide/actions/SearchEverywhereAction.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 9f81d26ab6ef..260e74e27d43 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -382,7 +382,12 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA if (index >= 0) { final int newIndex = forward ? myTitleIndexes.next(index) : myTitleIndexes.prev(index); myList.setSelectedIndex(newIndex); - ListScrollingUtil.ensureIndexIsVisible(myList, myList.getSelectedIndex(), forward ? 1 : -1); + int more = myTitleIndexes.next(newIndex) - 1; + if (more < newIndex) { + more = myList.getItemsCount() - 1; + } + ListScrollingUtil.ensureIndexIsVisible(myList, more, forward ? 1 : -1); + ListScrollingUtil.ensureIndexIsVisible(myList, newIndex, forward ? 1 : -1); } } From ad20fee54d747baeb94ddc6eaf666489d0dff474 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Tue, 29 Oct 2013 16:01:27 +0400 Subject: [PATCH 15/43] 'os.error' is now defined in Python skeletons --- .../codeInsight/stdlib/PyStdlibModuleMembersProvider.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibModuleMembersProvider.java b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibModuleMembersProvider.java index b63799bf465f..80d3627ac083 100644 --- a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibModuleMembersProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibModuleMembersProvider.java @@ -17,10 +17,9 @@ package com.jetbrains.python.codeInsight.stdlib; import com.intellij.openapi.util.SystemInfo; import com.intellij.psi.PsiElement; +import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.codeInsight.PyDynamicMember; import com.jetbrains.python.psi.PyFile; -import com.jetbrains.python.psi.impl.PyBuiltinCache; -import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.psi.resolve.ResolveImportUtil; import com.jetbrains.python.psi.types.PyModuleMembersProvider; @@ -38,15 +37,10 @@ public class PyStdlibModuleMembersProvider extends PyModuleMembersProvider { if (qName.equals("os")) { final List results = new ArrayList(); PsiElement path = null; - PsiElement osError = null; if (module != null) { - final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(module); - osError = builtinCache.getByName("OSError"); - final String pathModuleName = SystemInfo.isWindows ? "ntpath" : "posixpath"; path = ResolveImportUtil.resolveModuleInRoots(QualifiedName.fromDottedString(pathModuleName), module); } - results.add(new PyDynamicMember("error", osError)); results.add(new PyDynamicMember("path", path)); return results; } From aa8d3a61775aac7c33fa73ccc0b52d20468a19ba Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 29 Oct 2013 16:20:34 +0400 Subject: [PATCH 16/43] make static method public --- .../src/com/intellij/ui/popup/PopupPositionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java b/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java index e024091cd172..ea9a263d5713 100644 --- a/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java +++ b/platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java @@ -283,7 +283,7 @@ public class PopupPositionManager { return result; } - protected static Dimension getPopupSize(final JBPopup popup) { + public static Dimension getPopupSize(final JBPopup popup) { Dimension size = null; if (popup instanceof AbstractPopup) { final String dimensionKey = ((AbstractPopup)popup).getDimensionServiceKey(); From 2f1950f1c7d5b9997ffc9e8a715e6c288c0e3a2e Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 29 Oct 2013 16:20:56 +0400 Subject: [PATCH 17/43] IDEA-115561 Appearance of vertical and horizontal scroll bars in the search results is unexpected often --- .../ide/actions/SearchEverywhereAction.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 260e74e27d43..2c01b0480bad 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -1506,7 +1506,36 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA } private void adjustPopup() { - new PopupPositionManager.PositionAdjuster(getField().getParent(), 0).adjust(myPopup, PopupPositionManager.Position.BOTTOM); +// new PopupPositionManager.PositionAdjuster(getField().getParent(), 0).adjust(myPopup, PopupPositionManager.Position.BOTTOM); + final Dimension d = PopupPositionManager.PositionAdjuster.getPopupSize(myPopup); + final JComponent myRelativeTo = myBalloon.getContent(); + Point myRelativeOnScreen = myRelativeTo.getLocationOnScreen(); + Rectangle screen = ScreenUtil.getScreenRectangle(myRelativeOnScreen); + Rectangle popupRect = null; + Rectangle r = new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myRelativeTo.getHeight(), d.width, d.height); + + if (screen.contains(r)) { + popupRect = r; + } + + if (popupRect != null) { + myPopup.setLocation(new Point(r.x, r.y)); + } + else { + if (r.y + d.height > screen.y + screen.height) { + r.height = screen.y + screen.height - r.y - 2; + } + if (r.width > screen.width) { + r.width = screen.width - 50; + } + if (r.x + r.width > screen.x + screen.width) { + r.x = screen.x + screen.width - r.width - 2; + } + + myPopup.setSize(r.getSize()); + myPopup.setLocation(r.getLocation()); + } + } private static boolean isToolWindowAction(Object o) { From d56e66b8a1a2c2d3528739c5898cb8f7d9c6b50f Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Tue, 29 Oct 2013 17:14:39 +0400 Subject: [PATCH 18/43] IDEA-113758 Create Specifications when creating tests --- .../code/Spock SetUp Method.groovy.ft | 3 + .../code/Spock SetUp Method.groovy.html | 27 ++++ .../code/Spock Test Method.groovy.ft | 3 + .../code/Spock Test Method.groovy.html | 27 ++++ .../code/Spock cleanup Method.groovy.ft | 3 + .../code/Spock cleanup Method.groovy.html | 27 ++++ plugins/groovy/src/META-INF/plugin.xml | 2 + .../groovy/spock/SpockTestFramework.java | 117 ++++++++++++++++++ 8 files changed, 209 insertions(+) create mode 100644 plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.ft create mode 100644 plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.html create mode 100644 plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.ft create mode 100644 plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.html create mode 100644 plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.ft create mode 100644 plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.html create mode 100644 plugins/groovy/src/org/jetbrains/plugins/groovy/spock/SpockTestFramework.java diff --git a/plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.ft b/plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.ft new file mode 100644 index 000000000000..303209e1a46f --- /dev/null +++ b/plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.ft @@ -0,0 +1,3 @@ +void setup() { + ${BODY} +} \ No newline at end of file diff --git a/plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.html b/plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.html new file mode 100644 index 000000000000..379785f36c3f --- /dev/null +++ b/plugins/groovy/resources/fileTemplates/code/Spock SetUp Method.groovy.html @@ -0,0 +1,27 @@ + + + + + + +
+ This is a template used to create a setup() method in Spock test class. + +
+ + + + + + + + + + + + + + +
Predefined variables will take the following values:
${NAME} name of the created method.
${BODY} generated method body.
+ + \ No newline at end of file diff --git a/plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.ft b/plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.ft new file mode 100644 index 000000000000..57246e57ea5f --- /dev/null +++ b/plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.ft @@ -0,0 +1,3 @@ +def "${NAME}"() { +${BODY} +} \ No newline at end of file diff --git a/plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.html b/plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.html new file mode 100644 index 000000000000..f9789fc6a2c4 --- /dev/null +++ b/plugins/groovy/resources/fileTemplates/code/Spock Test Method.groovy.html @@ -0,0 +1,27 @@ + + + + + + +
+ This is a template used to create a test method in Spock test class. + +
+ + + + + + + + + + + + + + +
Predefined variables will take the following values:
${NAME} name of the created method.
${BODY} generated method body.
+ + diff --git a/plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.ft b/plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.ft new file mode 100644 index 000000000000..93fac82ea558 --- /dev/null +++ b/plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.ft @@ -0,0 +1,3 @@ +void cleanup() { + ${BODY} +} \ No newline at end of file diff --git a/plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.html b/plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.html new file mode 100644 index 000000000000..0517d8d4bc17 --- /dev/null +++ b/plugins/groovy/resources/fileTemplates/code/Spock cleanup Method.groovy.html @@ -0,0 +1,27 @@ + + + + + + +
+ This is a template used to create a cleanup() method in Spock test class. + +
+ + + + + + + + + + + + + + +
Predefined variables will take the following values:
${NAME} name of the created method.
${BODY} generated method body.
+ + \ No newline at end of file diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 46076a66a3ef..d835e4583898 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -209,6 +209,8 @@ implementationClass="org.jetbrains.plugins.groovy.findUsages.GrFileItemPresentationProvider"/> + + Date: Tue, 29 Oct 2013 17:26:17 +0400 Subject: [PATCH 19/43] Enabling jumplist for IDEA-108265. --- platform/platform-resources-en/src/misc/registry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 32bd09cfdbbe..86743aa374d9 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -311,7 +311,7 @@ ide.mac.message.sheets.java.emulation=false ide.mac.message.sheets.java.emulation.description=Use Java message sheets instead of native ones linux.native.menu=false linux.native.menu.description=Enables native menu on Ubuntu -windows.jumplist=false +windows.jumplist=true windows.jumplist.description=Enables JumpLists on Windows # suppress inspection "UnusedProperty" From 7eea5acd5c740db464e465c7b1de2ef9ea5e05c0 Mon Sep 17 00:00:00 2001 From: Alexey Utkin Date: Tue, 29 Oct 2013 17:31:46 +0400 Subject: [PATCH 20/43] Fix OC-3040 rollback changes in platform +review CR-OC-1015 --- .../source/PostprocessReformattingAspect.java | 126 ++++++------------ 1 file changed, 42 insertions(+), 84 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java index 1b190245cf5e..af96331aa306 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java @@ -375,6 +375,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { final PostprocessFormattingTask currentTask = iterator.next(); if (accumulatedTask == null) { accumulatedTask = currentTask; + iterator.remove(); } else if (accumulatedTask.getStartOffset() > currentTask.getEndOffset() || accumulatedTask.getStartOffset() == currentTask.getEndOffset() && @@ -388,6 +389,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { } accumulatedTask = currentTask; + iterator.remove(); } else if (accumulatedTask instanceof ReformatTask && currentTask instanceof ReindentTask) { // split accumulated reformat range into two @@ -403,93 +405,49 @@ public class PostprocessReformattingAspect implements PomModelAspect { final RangeMarker rangeToProcess = document.createRangeMarker(currentTask.getEndOffset(), accumulatedTask.getEndOffset()); freeFormattingActions.add(new ReformatWithHeadingWhitespaceTask(rangeToProcess)); accumulatedTask = currentTask; - } - else if (!(accumulatedTask instanceof ReindentTask)) { - boolean withLeadingWhitespace = accumulatedTask instanceof ReformatWithHeadingWhitespaceTask; - if (accumulatedTask instanceof ReformatTask && - currentTask instanceof ReformatWithHeadingWhitespaceTask && - accumulatedTask.getStartOffset() == currentTask.getStartOffset()) { - withLeadingWhitespace = true; - } - else if (accumulatedTask instanceof ReformatWithHeadingWhitespaceTask && - currentTask instanceof ReformatTask && - accumulatedTask.getStartOffset() < currentTask.getStartOffset()) { - withLeadingWhitespace = false; - } - int newStart = Math.min(accumulatedTask.getStartOffset(), currentTask.getStartOffset()); - int newEnd = Math.max(accumulatedTask.getEndOffset(), currentTask.getEndOffset()); - RangeMarker rangeMarker; - - if (accumulatedTask.getStartOffset() == newStart && accumulatedTask.getEndOffset() == newEnd) { - rangeMarker = accumulatedTask.getRange(); - } - else if (currentTask.getStartOffset() == newStart && currentTask.getEndOffset() == newEnd) { - rangeMarker = currentTask.getRange(); - } - else { - rangeMarker = document.createRangeMarker(newStart, newEnd); - } - - if (withLeadingWhitespace) { - accumulatedTask = new ReformatWithHeadingWhitespaceTask(rangeMarker); - } - else { - accumulatedTask = new ReformatTask(rangeMarker); - } - } - // accumulatedTask is an instance of ReindentTask - else if (currentTask instanceof ReindentTask) { - // child indent is different from parent, the child condition - // accumulatedTask.getStartOffset() <= currentTask.getStartOffset() - // && accumulatedTask.getEndOffset() >= currentTask.getEndOffset() - // is always true here (ordered-by-end + up "if" in the method): - - final CharSequence charsSequence = document.getCharsSequence(); - int curEndOffset = currentTask.getEndOffset(); - int curStartOffset = currentTask.getStartOffset(); - - // don't process ranges that have no new lines: - // optimization: the case is covered by formatting task, or does not need the indent (fragment-in-the-middle-of-line). - // compatibility: inline blocks have wrong indent due to historical reasons (always for inline function calls). - if (charsSequence.subSequence(curStartOffset, curEndOffset).toString().indexOf('\n') != -1) { - if (accumulatedTask.getEndOffset() > curEndOffset) { - // tail of parent indent (the order is from-end-to-start) - // restore "canonical" indent for calibration of the indent - freeFormattingActions.add(new ReformatWithHeadingWhitespaceTask(document.createRangeMarker(curEndOffset, curEndOffset))); - - // add the indent, - // push indent task directly, that is in correct from-end-to-start order. - indentActions.add(new ReindentTask( - document.createRangeMarker(curEndOffset, accumulatedTask.getEndOffset()), - ((ReindentTask)accumulatedTask).getOldIndent())); - } - - if (accumulatedTask.getStartOffset() < curStartOffset) { - // head of parent indent (the order is from-end-to-start) - // the "canonical" indent for calibration of the indent should be prepared by previous tasks - // here don't care about. - // cannot push indent task directly, some child range task could be found. - rangesToProcess.add(new ReindentTask( - document.createRangeMarker(accumulatedTask.getStartOffset(), curStartOffset - 1), - ((ReindentTask)accumulatedTask).getOldIndent())); - - //restore position - iterator = rangesToProcess.iterator(); - //noinspection StatementWithEmptyBody - while (iterator.next().getRange() != currentTask.getRange()) ; - } - - //body - final RangeMarker rangeToProcess = document.createRangeMarker(curStartOffset, curStartOffset); - freeFormattingActions.add(new ReformatWithHeadingWhitespaceTask(rangeToProcess)); - accumulatedTask = currentTask; - } - //else do nothing, just drop unused ReindentTask [currentTask] + iterator.remove(); } else { - continue; + if (!(accumulatedTask instanceof ReindentTask)) { + iterator.remove(); + + boolean withLeadingWhitespace = accumulatedTask instanceof ReformatWithHeadingWhitespaceTask; + if (accumulatedTask instanceof ReformatTask && + currentTask instanceof ReformatWithHeadingWhitespaceTask && + accumulatedTask.getStartOffset() == currentTask.getStartOffset()) { + withLeadingWhitespace = true; + } + else if (accumulatedTask instanceof ReformatWithHeadingWhitespaceTask && + currentTask instanceof ReformatTask && + accumulatedTask.getStartOffset() < currentTask.getStartOffset()) { + withLeadingWhitespace = false; + } + int newStart = Math.min(accumulatedTask.getStartOffset(), currentTask.getStartOffset()); + int newEnd = Math.max(accumulatedTask.getEndOffset(), currentTask.getEndOffset()); + RangeMarker rangeMarker; + + if (accumulatedTask.getStartOffset() == newStart && accumulatedTask.getEndOffset() == newEnd) { + rangeMarker = accumulatedTask.getRange(); + } + else if (currentTask.getStartOffset() == newStart && currentTask.getEndOffset() == newEnd) { + rangeMarker = currentTask.getRange(); + } + else { + rangeMarker = document.createRangeMarker(newStart, newEnd); + } + + if (withLeadingWhitespace) { + accumulatedTask = new ReformatWithHeadingWhitespaceTask(rangeMarker); + } + else { + accumulatedTask = new ReformatTask(rangeMarker); + + } + } + else if (currentTask instanceof ReindentTask) { + iterator.remove(); + } // TODO[ik]: need to be fixed to correctly process indent inside indent } - iterator.remove(); } if (accumulatedTask != null) { if (accumulatedTask instanceof ReindentTask) { From c4f7d79f452169524692fa4334aec70fb97d7208 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 29 Oct 2013 18:38:46 +0400 Subject: [PATCH 21/43] IDEA-113332 Typing an attribute in XML/HTML files ends up with corrupted XML --- .../options/editor/WebEditorOptionsForm.form | 12 ++++++++++-- .../options/editor/WebEditorOptionsProvider.java | 8 +++++--- .../editorActions/XmlEqTypedHandler.java | 16 ++++++++++------ .../options/editor/WebEditorOptions.java | 13 ++++++++++--- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form index e5ee0c6eb0c3..4dd9851442ca 100644 --- a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form +++ b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsForm.form @@ -8,7 +8,7 @@ - + @@ -54,12 +54,20 @@ - + + + + + + + + + diff --git a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java index 1f437f870dd6..292e3e11826d 100644 --- a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java +++ b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java @@ -32,6 +32,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider { private JCheckBox myAutomaticallyInsertRequiredSubTagsCheckBox; private JCheckBox myAutomaticallyStartAttributeAfterCheckBox; private JBCheckBox mySelectWholeSelectorOnDoubleClick; + private JBCheckBox myAddQuotasForAttributeValue; public String getDisplayName() { @@ -46,15 +47,14 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider { return myWholePanel; } - - public boolean isModified() { final WebEditorOptions xmlEditorOptions = WebEditorOptions.getInstance(); return xmlEditorOptions.isAutomaticallyInsertClosingTag() != myAutomaticallyInsertClosingTagCheckBox.isSelected() || xmlEditorOptions.isAutomaticallyInsertRequiredAttributes() != myAutomaticallyInsertRequiredAttributesCheckBox.isSelected() || xmlEditorOptions.isAutomaticallyStartAttribute() != myAutomaticallyStartAttributeAfterCheckBox.isSelected() || xmlEditorOptions.isSelectWholeCssSelectorSuffixOnDoubleClick() != mySelectWholeSelectorOnDoubleClick.isSelected() || - xmlEditorOptions.isAutomaticallyInsertRequiredSubTags() != myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected(); + xmlEditorOptions.isAutomaticallyInsertRequiredSubTags() != myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected() || + xmlEditorOptions.isInsertQuotesForAttributeValue() != myAddQuotasForAttributeValue.isSelected(); } public void apply() throws ConfigurationException { @@ -64,6 +64,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider { xmlEditorOptions.setAutomaticallyInsertRequiredSubTags(myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected()); xmlEditorOptions.setAutomaticallyStartAttribute(myAutomaticallyStartAttributeAfterCheckBox.isSelected()); xmlEditorOptions.setSelectWholeCssSelectorSuffixOnDoubleClick(mySelectWholeSelectorOnDoubleClick.isSelected()); + xmlEditorOptions.setInsertQuotesForAttributeValue(myAddQuotasForAttributeValue.isSelected()); } public void reset() { @@ -73,6 +74,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider { myAutomaticallyInsertRequiredSubTagsCheckBox.setSelected(xmlEditorOptions.isAutomaticallyInsertRequiredSubTags()); myAutomaticallyStartAttributeAfterCheckBox.setSelected(xmlEditorOptions.isAutomaticallyStartAttribute()); mySelectWholeSelectorOnDoubleClick.setSelected(xmlEditorOptions.isSelectWholeCssSelectorSuffixOnDoubleClick()); + myAddQuotasForAttributeValue.setSelected(xmlEditorOptions.isInsertQuotesForAttributeValue()); } public void disposeUIResources() { diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java index 0e09baa2ec57..922d910dffc2 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java @@ -15,6 +15,7 @@ */ package com.intellij.codeInsight.editorActions; +import com.intellij.application.options.editor.WebEditorOptions; import com.intellij.codeInsight.AutoPopupController; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.editor.Editor; @@ -34,12 +35,15 @@ public class XmlEqTypedHandler extends TypedHandlerDelegate { Editor editor, PsiFile file, FileType fileType) { - boolean inXml = file.getLanguage() instanceof XMLLanguage || file.getViewProvider().getBaseLanguage() instanceof XMLLanguage; - if (c == '=' && inXml) { - int offset = editor.getCaretModel().getOffset(); - PsiElement at = file.findElementAt(offset - 1); - PsiElement atParent = at != null ? at.getParent() : null; - needToInsertQuotes = atParent instanceof XmlAttribute && ((XmlAttribute)atParent).getValueElement() == null; + + if (WebEditorOptions.getInstance().isInsertQuotesForAttributeValue()) { + boolean inXml = file.getLanguage() instanceof XMLLanguage || file.getViewProvider().getBaseLanguage() instanceof XMLLanguage; + if (c == '=' && inXml) { + int offset = editor.getCaretModel().getOffset(); + PsiElement at = file.findElementAt(offset - 1); + PsiElement atParent = at != null ? at.getParent() : null; + needToInsertQuotes = atParent instanceof XmlAttribute && ((XmlAttribute)atParent).getValueElement() == null; + } } return super.beforeCharTyped(c, project, editor, file, fileType); diff --git a/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java b/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java index aff6054fe055..f3504e66ac6c 100644 --- a/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java +++ b/xml/xml-analysis-impl/src/com/intellij/application/options/editor/WebEditorOptions.java @@ -45,6 +45,7 @@ public class WebEditorOptions implements PersistentStateComponent Date: Tue, 29 Oct 2013 18:44:14 +0400 Subject: [PATCH 22/43] IDEA-113332 Typing an attribute in XML/HTML files ends up with corrupted XML --- .../completion/XmlTypedHandlersTest.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java index bcc1afbe797d..6c4b73f1789c 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java @@ -15,6 +15,7 @@ */ package com.intellij.codeInsight.completion; +import com.intellij.application.options.editor.WebEditorOptions; import com.intellij.ide.highlighter.XmlFileType; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; @@ -25,14 +26,27 @@ import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCa public class XmlTypedHandlersTest extends LightPlatformCodeInsightFixtureTestCase { public void testClosingTag() throws Exception { - myFixture.configureByText(XmlFileType.INSTANCE, "<"); - myFixture.type('/'); - myFixture.checkResult(""); + doTest("<", '/', ""); } public void testGreedyClosing() { - myFixture.configureByText(XmlFileType.INSTANCE, "<foo>"); - myFixture.type('/'); - myFixture.checkResult(""); + doTest("<foo>", '/', ""); + } + + public void testValueQuotas() throws Exception { + doTest("", '=', "\""); + WebEditorOptions.getInstance().setInsertQuotesForAttributeValue(false); + try { + doTest("", '=', ""); + } + finally { + WebEditorOptions.getInstance().setInsertQuotesForAttributeValue(true); + } + } + + private void doTest(String text, char c, String result) { + myFixture.configureByText(XmlFileType.INSTANCE, text); + myFixture.type(c); + myFixture.checkResult(result); } } From 9f92b82dbe568e699ca144b688f7e07fece91a74 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Tue, 29 Oct 2013 19:11:41 +0400 Subject: [PATCH 23/43] Added canonical import path for names of 'sqlite3' module --- .../codeInsight/stdlib/PyStdlibCanonicalPathProvider.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibCanonicalPathProvider.java b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibCanonicalPathProvider.java index 0dcba4f48569..1a097263c24a 100644 --- a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibCanonicalPathProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibCanonicalPathProvider.java @@ -69,6 +69,10 @@ public class PyStdlibCanonicalPathProvider implements PyCanonicalPathProvider { result.addAll(components); return QualifiedName.fromComponents(result); } + else if (head.equals("_sqlite3")) { + components.set(0, "sqlite3"); + return QualifiedName.fromComponents(components); + } } return null; } From 83f4128883306f544a25185abf521670496a6b54 Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Tue, 29 Oct 2013 19:28:55 +0400 Subject: [PATCH 24/43] Bug fix: Create Test dialog does not initialize 'superclass' field. --- .../createTest/CreateTestDialog.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java b/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java index 1185d60a7971..368d5bbadb51 100644 --- a/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java +++ b/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java @@ -40,6 +40,7 @@ import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.refactoring.PackageWrapper; @@ -215,13 +216,40 @@ public class CreateTestDialog extends DialogWrapper { updateMethodsTable(); } + private boolean isSuperclassSelectedManually() { + String superClass = mySuperClassField.getText(); + if (StringUtil.isEmptyOrSpaces(superClass)) { + return false; + } + + for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensions()) { + if (superClass.equals(framework.getDefaultSuperClass())) { + return false; + } + } + + return true; + } + private void onLibrarySelected(TestFramework descriptor) { String text = CodeInsightBundle.message("intention.create.test.dialog.library.not.found", descriptor.getName()); myFixLibraryLabel.setText(text); myFixLibraryPanel.setVisible(!descriptor.isLibraryAttached(myTargetModule)); String superClass = descriptor.getDefaultSuperClass(); - mySuperClassField.appendItem(superClass == null ? "" : superClass); + + if (isSuperclassSelectedManually()) { + if (superClass != null) { + String currentSuperClass = mySuperClassField.getText(); + mySuperClassField.appendItem(superClass); + mySuperClassField.setText(currentSuperClass); + } + } + else { + mySuperClassField.appendItem(StringUtil.notNullize(superClass)); + mySuperClassField.getChildComponent().setSelectedItem(StringUtil.notNullize(superClass)); + } + mySelectedFramework = descriptor; } @@ -524,7 +552,10 @@ public class CreateTestDialog extends DialogWrapper { dialog.showDialog(); PsiClass aClass = dialog.getSelected(); if (aClass != null) { - mySuperClassField.setText(aClass.getQualifiedName()); + String superClass = aClass.getQualifiedName(); + + mySuperClassField.appendItem(superClass); + mySuperClassField.getChildComponent().setSelectedItem(superClass); } } } From bb0b789fd02102f5b12962cd3a018a9e89716764 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Tue, 29 Oct 2013 19:33:53 +0400 Subject: [PATCH 25/43] Disabling JumpList because of some issues on win32 platform. --- platform/platform-resources-en/src/misc/registry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 86743aa374d9..32bd09cfdbbe 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -311,7 +311,7 @@ ide.mac.message.sheets.java.emulation=false ide.mac.message.sheets.java.emulation.description=Use Java message sheets instead of native ones linux.native.menu=false linux.native.menu.description=Enables native menu on Ubuntu -windows.jumplist=true +windows.jumplist=false windows.jumplist.description=Enables JumpLists on Windows # suppress inspection "UnusedProperty" From 53a88a7655222c3b024e9d31f6062db5dc70c6d7 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Tue, 29 Oct 2013 19:46:48 +0400 Subject: [PATCH 26/43] #WEB-555 fixed --- .../completion/XmlCompletionContributor.java | 14 +++++++++----- .../codeInsight/completion/XmlCompletionTest.java | 6 ++++++ .../completion/beforeAttributeNameWithPrefix.xml | 4 ++++ .../beforeAttributeNameWithPrefix_after.xml | 4 ++++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 xml/tests/testData/completion/beforeAttributeNameWithPrefix.xml create mode 100644 xml/tests/testData/completion/beforeAttributeNameWithPrefix_after.xml diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java index 3722f4cd8559..851c2f69bc4a 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java @@ -30,12 +30,10 @@ import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.text.StringUtil; import com.intellij.patterns.XmlPatterns; import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.psi.xml.XmlAttributeValue; -import com.intellij.psi.xml.XmlFile; -import com.intellij.psi.xml.XmlTag; -import com.intellij.psi.xml.XmlTokenType; +import com.intellij.psi.xml.*; import com.intellij.util.Consumer; import com.intellij.util.ProcessingContext; import com.intellij.xml.XmlBundle; @@ -199,9 +197,15 @@ public class XmlCompletionContributor extends CompletionContributor { public void beforeCompletion(@NotNull final CompletionInitializationContext context) { final int offset = context.getStartOffset(); - final XmlAttributeValue attributeValue = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), offset, XmlAttributeValue.class, true); + final PsiFile file = context.getFile(); + final XmlAttributeValue attributeValue = PsiTreeUtil.findElementOfClassAtOffset(file, offset, XmlAttributeValue.class, true); if (attributeValue != null && offset == attributeValue.getTextRange().getStartOffset()) { context.setDummyIdentifier(""); } + + final PsiElement at = file.findElementAt(offset); + if (at != null && at.getNode().getElementType() == XmlTokenType.XML_NAME && at.getParent() instanceof XmlAttribute) { + context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, at.getTextRange().getEndOffset()); + } } } diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java index 7d6df70ec21e..5e2f202fcd75 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java @@ -332,6 +332,12 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase { checkResultByFile(getTestName(true) + ".xml"); } + public void testBeforeAttributeNameWithPrefix() throws Exception { + configureByFile(getTestName(true) + ".xml"); + selectItem(myFixture.getLookupElements()[0], '\t'); + checkResultByFile(getTestName(true) + "_after.xml"); + } + public void testUrlCompletionInDtd() throws Exception { configureByFile("20.xml"); final PsiReference referenceAt = myFixture.getFile().findReferenceAt(myFixture.getEditor().getCaretModel().getOffset() - 1); diff --git a/xml/tests/testData/completion/beforeAttributeNameWithPrefix.xml b/xml/tests/testData/completion/beforeAttributeNameWithPrefix.xml new file mode 100644 index 000000000000..f56b18936847 --- /dev/null +++ b/xml/tests/testData/completion/beforeAttributeNameWithPrefix.xml @@ -0,0 +1,4 @@ + + + aaa:bbb="" value=""/> + \ No newline at end of file diff --git a/xml/tests/testData/completion/beforeAttributeNameWithPrefix_after.xml b/xml/tests/testData/completion/beforeAttributeNameWithPrefix_after.xml new file mode 100644 index 000000000000..961eb389d147 --- /dev/null +++ b/xml/tests/testData/completion/beforeAttributeNameWithPrefix_after.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From 8ca343f354bcd2fea0600811dffb2a46bc5362f0 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Tue, 29 Oct 2013 19:53:14 +0400 Subject: [PATCH 27/43] Removed properties-based stdlib types database --- python/helpers/StdlibTypes.properties | 921 ------------------ .../stdlib/PyStdlibTypeProvider.java | 109 +-- .../python/psi/impl/PyNamedParameterImpl.java | 7 - .../python/psi/types/PyTypeChecker.java | 10 - 4 files changed, 1 insertion(+), 1046 deletions(-) delete mode 100644 python/helpers/StdlibTypes.properties diff --git a/python/helpers/StdlibTypes.properties b/python/helpers/StdlibTypes.properties deleted file mode 100644 index 657e8f025db4..000000000000 --- a/python/helpers/StdlibTypes.properties +++ /dev/null @@ -1,921 +0,0 @@ -# Python stdlib - - -## 9.4. decimal - -decimal.Decimal.as_tuple = \ - :rtype: decimal.DecimalTuple \n\ - -decimal.Decimal.__new__ = \ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__add__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__sub__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__mul__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__floordiv__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__mod__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__pow__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__div__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__truediv__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__radd__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rsub__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rmul__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rfloordiv__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rmod__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rpow__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rdiv__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__rtruediv__ = \ - :type other: decimal.Decimal or int or long or float or complex \n\ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__pos__ = \ - :rtype: decimal.Decimal \n\ - -decimal.Decimal.__neg__ = \ - :rtype: decimal.Decimal \n\ - - -# 10.1. os.path - -os.path.abspath = \ - :type path: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.basename = \ - :type p: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.commonprefix = \ - :type m: collections.Iterable of T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.dirname = \ - :type p: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.exists = \ - :type path: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.lexists = \ - :type path: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.expanduser = \ - :type path: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.expandvars = \ - :type path: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.getatime = \ - :type filename: bytes or unicode \n\ - :rtype: int or float \n\ - -os.path.getmtime = \ - :type filename: bytes or unicode \n\ - :rtype: int or float \n\ - -os.path.getctime = \ - :type filename: bytes or unicode \n\ - :rtype: int or float \n\ - -os.path.getsize = \ - :type filename: bytes or unicode \n\ - :rtype: int or long \n\ - -os.path.isabs = \ - :type s: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.isfile = \ - :type path: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.isdir = \ - :type s: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.islink = \ - :type path: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.ismount = \ - :type path: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.join = \ - :type a: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.normcase = \ - :type s: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.normpath = \ - :type path: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.path.realpath = \ - :type filename: T <= bytes or unicode \n\ - :rtype: bytes or unicode \n\ - -os.path.relpath = \ - :type path: T <= bytes or unicode \n\ - :type start: bytes or unicode \n\ - :rtype: T \n\ - -os.path.samefile = \ - :type f1: bytes or unicode \n\ - :type f2: bytes or unicode \n\ - :rtype: bool \n\ - -os.path.sameopenfile = \ - :type fp1: int \n\ - :type fp2: int \n\ - :rtype: bool \n\ - -os.path.samestat = \ - :type s1: os.stat_result or tuple \n\ - :type s2: os.stat_result or tuple \n\ - :rtype: bool \n\ - -os.path.split = \ - :type p: T <= bytes or unicode \n\ - :rtype: (T, T) \n\ - -os.path.splitdrive = \ - :type p: T <= bytes or unicode \n\ - :rtype: (T, T) \n\ - -os.path.splitext = \ - :type p: T <= bytes or unicode \n\ - :rtype: (T, T) \n\ - -os.path.splitunc = \ - :type p: T <= bytes or unicode \n\ - :rtype: (T, T) \n\ - -os.path.walk = \ - :type top: bytes or unicode \n\ - :rtype: None \n\ - - -## 10.10. shutil - -shutil.copyfile = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype None \n\ - -shutil.copymode = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype None \n\ - -shutil.copystat = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype None \n\ - -shutil.copy = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype None \n\ - -shutil.copy2 = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype None \n\ - -shutil.copytree = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :type symlinks: bool \n\ - :type ignore: collections.Callable or None \n\ - :rtype None \n\ - -shutil.rmtree = \ - :type path: bytes or unicode \n\ - :type ignore_errors: bool\n\ - :type onerror: collections.Callable or None \n\ - :rtype None \n\ - -shutil.move = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype None \n\ - -shutil.make_archive = \ - :type base_name: bytes or unicode \n\ - :type format: bytes or unicode \n\ - :type root_dir: bytes or unicode or None \n\ - :type base_dir: bytes or unicode or None \n\ - :type verbose: bool or int \n\ - :type dry_run: bool or int \n\ - :type owner: bytes or unicode or int or None \n\ - :type group: bytes or unicode or int or None \n\ - :rtype: bytes or unicode \n\ - -shutil.get_archive_formats = \ - :rtype: list of (string, string) \n\ - -shutil.register_archive_format = \ - :type name: bytes or unicode \n\ - :type function: collections.Callable \n\ - :type extra_args: None or collections.Sequence of (string, object) \n\ - :type description: bytes or unicode \n\ - :rtype: None - -shutil.unregister_archive_format = \ - :type name: bytes or unicode \n\ - :rtype: None \n\ - - -## 11.13 sqlite3 - -_sqlite3.connect = \ - :type database: bytes or unicode \n\ - :rtype: _sqlite3.Connection - -_sqlite3.Connection.cursor = \ - :rtype: _sqlite3.Cursor - -## 15.1. os - -os.ctermid = \ - :rtype: unicode \n\ - -os.getegid = \ - :rtype: int \n\ - -os.geteuid = \ - :rtype: int \n\ - -os.getgid = \ - :rtype: int \n\ - -os.getgroups = \ - :rtype: list of int \n\ - -os.initgroups = \ - :type username: string \n\ - :type gid: int \n\ - :rtype: None \n\ - -os.getlogin = \ - :rtype: unicode \n\ - -os.getpgid = \ - :type pid: int \n\ - :rtype: int \n\ - -os.getpgrp = \ - :rtype: int \n\ - -os.getpid = \ - :rtype: int \n\ - -os.getresuid = \ - :rtype: (int, int, int) \n\ - -os.getuid = \ - :rtype: int \n\ - -os.getenv = \ - :type key: string \n\ - :type default: object \n\ - :rtype: string \n\ - -os.putenv = \ - :type key: bytes or unicode \n\ - :type value: bytes or unicode \n\ - :rtype: None \n\ - -os.setegid = \ - :type gid: int \n\ - :rtype: None \n\ - -os.seteuid = \ - :type uid: int \n\ - :rtype: None \n\ - -os.setgid = \ - :type gid: int \n\ - :rtype: None \n\ - -os.setgroups = \ - :type p_list: list of int \n\ - :rtype: None \n\ - -os.setpgrp = \ - :rtype: None \n\ - -os.setpgid = \ - :type pid: int \n\ - :type pgrp: int \n\ - :rtype: None \n\ - -os.setregid = \ - :type rgid: int \n\ - :type egid: int \n\ - :rtype: None \n\ - -os.setresgid = \ - :type rgid: int \n\ - :type egid: int \n\ - :type sgid: int \n\ - :rtype: None \n\ - -os.setresuid = \ - :type ruid: int \n\ - :type euid: int \n\ - :type suid: int \n\ - :rtype: None \n\ - -os.setreuid = \ - :type ruid: int \n\ - :type euid: int \n\ - :rtype: None \n\ - -os.getsid = \ - :type pid: int \n\ - :rtype: int \n\ - -os.setsid = \ - :rtype: None \n\ - -os.setuid = \ - :type uid: int \n\ - :rtype: None \n\ - -os.strerror = \ - :type code: int \n\ - :rtype: unicode \n\ - -os.umask = \ - :type new_mask: int \n\ - :rtype: int \n\ - -os.uname = \ - :rtype: (unicode, unicode, unicode, unicode, unicode) \n\ - -os.unsetenv = \ - :type key: string \n\ - :rtype: None \n\ - -os.fdopen = \ - :type fd: int \n\ - :type mode: string \n\ - :type bufsize: int \n\ - :rtype: file \n\ - -os.popen = \ - :type command: string \n\ - :type mode: string \n\ - :type bufsize: int \n\ - :rtype: io.FileIO \n\ - -os.tmpfile = \ - :rtype: io.FileIO \n\ - -os.popen2 = \ - :type cmd: string \n\ - :type mode: string \n\ - :type bufsize: int \n\ - :rtype: (io.FileIO, io.FileIO) \n\ - -os.popen3 = \ - :type cmd: string \n\ - :type mode: string \n\ - :type bufsize: int \n\ - :rtype: (io.FileIO, io.FileIO, io.FileIO) \n\ - -os.popen4 = \ - :type cmd: string \n\ - :type mode: string \n\ - :type bufsize: int \n\ - :rtype: (io.FileIO, io.FileIO) \n\ - -os.close = \ - :type fd: int \n\ - :rtype: None \n\ - -os.closerange = \ - :type fd_low: int \n\ - :type fd_high: int \n\ - :rtype: None \n\ - -os.dup = \ - :type fd: int \n\ - :rtype: int \n\ - -os.dup2 = \ - :type old_fd: int \n\ - :type new_fd: int \n\ - :rtype: None \n\ - -os.fchmod = \ - :type fd: int \n\ - :type mode: int \n\ - :rtype: None \n\ - -os.fchown = \ - :type fd: int \n\ - :type uid: int \n\ - :type gid: int \n\ - :rtype: None \n\ - -os.fdatasync = \ - :type fildes: int \n\ - :rtype: None \n\ - -os.fpathconf = \ - :type fd: int \n\ - :type name: int or string \n\ - -os.fstat = \ - :type fd: int \n\ - :rtype: os.stat_result \n\ - -os.fstatvfs = \ - :type fd: int \n\ - :rtype: os.statvfs_result \n\ - -os.fsync = \ - :type filedes: int \n\ - :rtype: None \n\ - -os.ftruncate = \ - :type fd: int \n\ - :type length: int or long \n\ - :rtype: None \n\ - -os.isatty = \ - :type fd: int \n\ - :rtype: bool \n\ - -os.lseek = \ - :type fd: int \n\ - :type pos: int or long \n\ - :type how: int \n\ - :rtype: None \n\ - -os.open = \ - :type filename: string \n\ - :type mode: string \n\ - :type bufsize: int \n\ - :rtype: int \n\ - -os.openpty = \ - :rtype: (int, int) \n\ - -os.pipe = \ - :rtype: (int, int) \n\ - -os.read = \ - :type fd: int \b\ - :type buffersize: int or long \n\ - :rtype: bytes \n\ - -os.tcgetpgrp = \ - :type fd: int \n\ - :rtype: int \n\ - -os.tcsetpgrp = \ - :type fd: int \n\ - :type pgid: int \n\ - :rtype: None \n\ - -os.ttyname = \ - :type fd: int \n\ - :rtype: unicode \n\ - -os.write = \ - :type fd: int \n\ - :type string: bytes \n\ - :rtype: int \n\ - -os.access = \ - :type path: bytes or unicode \n\ - :type mode: int \n\ - :rtype: bool \n\ - -os.chdir = \ - :type path: bytes or unicode \n\ - :rtype: None \n\ - -os.fchdir = \ - :type filedes: int \n\ - :rtype: None \n\ - -os.getcwd = \ - :rtype: str \n\ - -os.getcwdu = \ - :rtype: unicode \n\ - -os.chroot = \ - :type path: bytes or unicode \n\ - :rtype: None \n\ - -os.chmod = \ - :type path: bytes or unicode \n\ - :type mode: int \n\ - :rtype: None \n\ - -os.chown = \ - :type path: bytes or unicode \n\ - :type uid: int \n\ - :type gid: int \n\ - :rtype: None \n\ - -os.lchown = \ - :type path: bytes or unicode \n\ - :type uid: int \n\ - :type gid: int \n\ - :rtype: None \n\ - -os.link = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype: None \n\ - -os.listdir = \ - :type path: T <= bytes or unicode \n\ - :rtype: list of T \n\ - -os.lstat = \ - :type path: bytes or unicode \n\ - :rtype: os.stat_result \n\ - -os.mkfifo = \ - :type filename: bytes or unicode \n\ - :type mode: int \n\ - :rtype: None \n\ - -os.mknod = \ - :type filename: bytes or unicode \n\ - :type mode: int \n\ - :type device: int \n\ - :rtype: None \n\ - -os.major = \ - :type device: int \n\ - :rtype: int \n\ - -os.minor = \ - :type device: int \n\ - :rtype: int \n\ - -os.makedev = \ - :type major: int \n\ - :type minor: int \n\ - :rtype: int \n\ - -os.mkdir = \ - :type path: bytes or unicode \n\ - :type mode: int \n\ - :rtype: None \n\ - -os.makedirs = \ - :type name: bytes or unicode \n\ - :type mode: int \n\ - :rtype: None \n\ - -os.pathconf = \ - :type path: bytes or unicode \n\ - :type name: int or string \n\ - -os.readlink = \ - :type path: T <= bytes or unicode \n\ - :rtype: T \n\ - -os.remove = \ - :type path: bytes or unicode \n\ - :rtype: None \n\ - -os.removedirs = \ - :type name: bytes or unicode \n\ - :rtype: None \n\ - -os.rename = \ - :type old: bytes or unicode \n\ - :type new: bytes or unicode \n\ - :rtype: None \n\ - -os.renames = \ - :type old: bytes or unicode \n\ - :type new: bytes or unicode \n\ - :rtype: None \n\ - -os.rmdir = \ - :type path: bytes or unicode \n\ - :rtype: None \n\ - -os.stat = \ - :type path: bytes or unicode \n\ - :rtype: os.stat_result \n\ - -os.stat_float_times = \ - :type newval: bool or None \n\ - :rtype: bool \n\ - -os.statvfs = \ - :type path: bytes or unicode \n\ - :rtype: os.statvfs_result \n\ - -os.symlink = \ - :type src: bytes or unicode \n\ - :type dst: bytes or unicode \n\ - :rtype: None \n\ - -os.tempnam = \ - :type dir: bytes or unicode \n\ - :type prefix: bytes or unicode \n\ - :rtype: string \n\ - -os.tmpnam = \ - :rtype: string \n\ - -os.unlink = \ - :type path: bytes or unicode \n\ - :rtype: None \n\ - -os.utime = \ - :type path: bytes or unicode \n\ - :type atime: int or float \n\ - :type mtime: int or float \n\ - :rtype: None \n\ - -os.walk = \ - :type top: T <= bytes or unicode \n\ - :type topdown: bool \n\ - :type followlinks: bool \n\ - :rtype: collections.Iterable of (T, list of T, list of T) \n\ - -os.execl = \ - :type file: bytes or unicode \n\ - :rtype: None \n\ - -os.execle = \ - :type file: bytes or unicode \n\ - :rtype: None \n\ - -os.execlp = \ - :type file: bytes or unicode \n\ - :rtype: None \n\ - -os.execlpe = \ - :type file: bytes or unicode \n\ - :rtype: None \n\ - -os.execv = \ - :type path: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :rtype: None \n\ - -os.execve = \ - :type path: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :type env: collections.Mapping of (string, string) \n\ - :rtype: None \n\ - -os.execvp = \ - :type file: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :rtype: None \n\ - -os.execvpe = \ - :type file: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :type env: collections.Mapping of (string, string) \n\ - :rtype: None \n\ - -os._exit = \ - :type status: int \n\ - :rtype: None \n\ - -os.fork = \ - :rtype: int \n\ - -os.forkpty = \ - :rtype: (int, int) \n\ - -os.kill = \ - :type pid: int \n\ - :type sig: int \n\ - :rtype: None \n\ - -os.killpg = \ - :type pgid: int \n\ - :type sig: int \n\ - :rtype: None \n\ - -os.nice = \ - :type inc: int \n\ - :rtype: int \n\ - -os.spawnl = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :rtype: int \n\ - -os.spawnle = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :rtype: int \n\ - -os.spawnlp = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :rtype: int \n\ - -os.spawnlpe = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :rtype: int \n\ - -os.spawnv = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :rtype: int \n\ - -os.spawnve = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :type env: collections.Mapping of (string, string) \n\ - :rtype: int \n\ - -os.spawnvp = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :rtype: int \n\ - -os.spawnvpe = \ - :type mode: int \n\ - :type file: bytes or unicode \n\ - :type args: collections.Iterable of string \n\ - :type env: collections.Mapping of (string, string) \n\ - :rtype: int \n\ - -os.system = \ - :type command: bytes or unicode \n\ - :rtype: int \n\ - -os.times = \ - :rtype: (float, float, float, float, float) \n\ - -os.wait = \ - :rtype: (int, int) \n\ - -os.waitpid = \ - :type pid: int \n\ - :type options: int \n\ - :rtype: (int, int) \n\ - -os.wait3 = \ - :type options: int \n\ - :rtype: (int, int, resource.struct_rusage) \n\ - -os.wait4 = \ - :type pid: int \n\ - :type options: int \n\ - :rtype: (int, int, resource.struct_rusage) \n\ - -os.WCOREDUMP = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WIFCONTINUED = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WIFSTOPPED = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WIFSIGNALED = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WIFEXITED = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WEXITSTATUS = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WSTOPSIG = \ - :type status: int \n\ - :rtype: bool \n\ - -os.WTERMSIG = \ - :type status: int \n\ - :rtype: bool \n\ - -os.urandom = \ - :type n: int \n\ - :rtype: bytes \n\ - - -## 17.1. subprocess - -subprocess.Popen.__init__ = \ - :type args: string or collections.Sequence of string \n\ - :type executable: string or None \n\ - :type preexec_fn: collections.Callable or None \n\ - :type close_fds: bool or int \n\ - :type shell: bool or int \n\ - :type cwd: string or None \n\ - :type env: collections.Mapping of (string, string) \n\ - :type universal_newlines: bool or int \n\ - -subprocess.Popen.poll = \ - :rtype: int \n\ - -subprocess.Popen.wait = \ - :rtype: int \n\ - -subprocess.Popen.communicate = \ - :type intput: string or None \n\ - :rtype: (bytes, bytes) \n\ - -subprocess.Popen.send_signal = \ - :type sig: int \n\ - - -## 18.2. json - -json.loads = \ - :type s: string \n\ - :type encoding: string \n\ - :rtype: object or unknown \n\ - - -## 18.12. base64 - -base64.b64encode = \ - :type s: bytes \n\ - :rtype: bytes \n\ - -base64.b64decode = \ - :type s: bytes \n\ - :rtype: bytes \n\ - - -## 27.1. sys - -sys.exit = \ - :type status: int or object \n\ - :rtype: None \n\ diff --git a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java index b760346e35f8..cf6b9ef19301 100644 --- a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java @@ -17,16 +17,12 @@ package com.jetbrains.python.codeInsight.stdlib; import com.google.common.collect.ImmutableSet; import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; +import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.PyNames; -import com.jetbrains.python.PythonHelpersLocator; -import com.jetbrains.python.documentation.DocStringUtil; -import com.jetbrains.python.psi.StructuredDocString; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.impl.PyBuiltinCache; -import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.psi.impl.PyTypeProvider; import com.jetbrains.python.psi.resolve.PyResolveContext; import com.jetbrains.python.psi.resolve.QualifiedNameFinder; @@ -34,19 +30,13 @@ import com.jetbrains.python.psi.types.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; import java.util.Map; -import java.util.Properties; import java.util.Set; /** * @author yole */ public class PyStdlibTypeProvider extends PyTypeProviderBase { - @NotNull private Properties myStdlibTypes = new Properties(); - private static final Set OPEN_FUNCTIONS = ImmutableSet.of("__builtin__.open", "io.open", "os.fdopen"); private static final String BINARY_FILE_TYPE = "io.FileIO[bytes]"; private static final String TEXT_FILE_TYPE = "io.TextIOWrapper[unicode]"; @@ -104,54 +94,6 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase { } } } - return getReturnTypeByQName(qname, function, context); - } - return null; - } - - @Nullable - public PyType getConstructorType(@NotNull PyClass cls, @NotNull TypeEvalContext context) { - final String classQName = cls.getQualifiedName(); - if (classQName != null) { - final QualifiedName - canonicalQName = PyStdlibCanonicalPathProvider.restoreStdlibCanonicalPath(QualifiedName.fromDottedString(classQName)); - if (canonicalQName != null) { - final QualifiedName qname = canonicalQName.append(PyNames.INIT); - return getReturnTypeByQName(qname.toString(), cls, context); - } - } - return null; - } - - @Nullable - private PyType getReturnTypeByQName(@NotNull String qname, @NotNull PsiElement anchor, @NotNull TypeEvalContext context) { - final LanguageLevel level = LanguageLevel.forElement(anchor); - final String key = String.format("Python%d/%s.return", level.getVersion(), qname); - final PyBuiltinCache cache = PyBuiltinCache.getInstance(anchor); - final Ref cached = cache.getStdlibType(key, context); - if (cached != null) { - return cached.get(); - } - final StructuredDocString docString = getStructuredDocString(qname); - if (docString == null) { - return null; - } - final String s = docString.getReturnType(); - if (s == null) { - return null; - } - final PyType result = PyTypeParser.getTypeByName(anchor, s); - cache.storeStdlibType(key, result); - return result; - } - - @Nullable - @Override - public PyType getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context) { - final String name = param.getName(); - final String qname = getQualifiedName(func, param); - if (qname != null && name != null) { - return getParameterTypeByQName(qname, name, func, context); } return null; } @@ -215,38 +157,6 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase { } } - @Nullable - private PyType getParameterTypeByQName(@NotNull String functionQName, - @NotNull String name, - @NotNull PsiElement anchor, - @NotNull TypeEvalContext context) { - final LanguageLevel level = LanguageLevel.forElement(anchor); - final String key = String.format("Python%d/%s.%s", level.getVersion(), functionQName, name); - final PyBuiltinCache cache = PyBuiltinCache.getInstance(anchor); - final Ref cached = cache.getStdlibType(key, context); - if (cached != null) { - return cached.get(); - } - final StructuredDocString docString = getStructuredDocString(functionQName); - if (docString == null) { - return null; - } - final String s = docString.getParamType(name); - if (s == null) { - return null; - } - final PyType result = PyTypeParser.getTypeByName(anchor, s); - cache.storeStdlibType(key, result); - return result; - } - - @Nullable - private StructuredDocString getStructuredDocString(@NotNull String qualifiedName) { - final Properties db = getStdlibTypes(); - final String docString = db.getProperty(qualifiedName); - return DocStringUtil.parse(docString); - } - @Nullable private static String getQualifiedName(@NotNull PyFunction f, @Nullable PsiElement callSite) { if (!f.isValid()) { @@ -271,21 +181,4 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase { } return result; } - - @NotNull - private Properties getStdlibTypes() { - if (myStdlibTypes.isEmpty()) { - try { - final InputStream s = new FileInputStream(PythonHelpersLocator.getHelperFile("StdlibTypes.properties")); - try { - myStdlibTypes.load(s); - } - finally { - s.close(); - } - } - catch (IOException ignored) {} - } - return myStdlibTypes; - } } diff --git a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java index 2164da1b224e..ec683d667da3 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java @@ -31,7 +31,6 @@ import com.jetbrains.python.PyElementTypes; import com.jetbrains.python.PyNames; import com.jetbrains.python.PyTokenTypes; import com.jetbrains.python.PythonDialectsTokenSetProvider; -import com.jetbrains.python.codeInsight.stdlib.PyStdlibTypeProvider; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.resolve.PyResolveContext; import com.jetbrains.python.psi.stubs.PyNamedParameterStub; @@ -215,12 +214,6 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl Date: Mon, 28 Oct 2013 10:26:26 +0100 Subject: [PATCH 28/43] more diagnostic for assertion --- .../src/com/intellij/psi/impl/PsiParserFacadeImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiParserFacadeImpl.java b/platform/core-impl/src/com/intellij/psi/impl/PsiParserFacadeImpl.java index 3c96256f421e..a8237989200b 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiParserFacadeImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiParserFacadeImpl.java @@ -79,7 +79,7 @@ public class PsiParserFacadeImpl implements PsiParserFacade { public PsiComment createLineOrBlockCommentFromText(@NotNull Language lang, @NotNull String text) throws IncorrectOperationException { Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(lang); - assert commenter != null; + assert commenter != null:lang; String prefix = commenter.getLineCommentPrefix(); final String blockCommentPrefix = commenter.getBlockCommentPrefix(); final String blockCommentSuffix = commenter.getBlockCommentSuffix(); From 7a6ff4c869f1252f7ae93dd2449e989891653d76 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 28 Oct 2013 17:56:42 +0100 Subject: [PATCH 29/43] check disposed state --- .../intellij/find/impl/livePreview/LivePreviewController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java index 9ba74e3e134e..4c22654f5340 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java +++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java @@ -117,6 +117,7 @@ public class LivePreviewController implements LivePreview.Delegate, FindUtil.Rep Runnable request = new Runnable() { @Override public void run() { + if (myDisposed) return; mySearchResults.updateThreadSafe(copy, allowedToChangedEditorSelection, null, stamp); } }; From 54e17443e41a148e3c74c2d32577cf54ca4de1a3 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 17:03:03 +0400 Subject: [PATCH 30/43] [log] New icons for expand/collapse branches & show/hide long edges --- .../impl/resources/icons/CollapseBranches.png | Bin 0 -> 337 bytes .../resources/icons/CollapseBranches@2x.png | Bin 0 -> 615 bytes .../icons/CollapseBranches@2x_dark.png | Bin 0 -> 597 bytes .../resources/icons/CollapseBranches_dark.png | Bin 0 -> 353 bytes .../impl/resources/icons/ExpandBranches.png | Bin 0 -> 339 bytes .../resources/icons/ExpandBranches@2x.png | Bin 0 -> 611 bytes .../icons/ExpandBranches@2x_dark.png | Bin 0 -> 587 bytes .../resources/icons/ExpandBranches_dark.png | Bin 0 -> 337 bytes .../resources/icons/ShowHideLongEdges.png | Bin 0 -> 305 bytes .../resources/icons/ShowHideLongEdges@2x.png | Bin 0 -> 516 bytes .../icons/ShowHideLongEdges@2x_dark.png | Bin 0 -> 507 bytes .../icons/ShowHideLongEdges_dark.png | Bin 0 -> 302 bytes .../intellij/vcs/log/ui/frame/MainFrame.java | 7 +++--- .../vcs-log/impl/src/icons/VcsLogIcons.java | 21 ++++++++++++++++++ platform/vcs-log/impl/vcs-log-impl.iml | 1 + 15 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 platform/vcs-log/impl/resources/icons/CollapseBranches.png create mode 100755 platform/vcs-log/impl/resources/icons/CollapseBranches@2x.png create mode 100755 platform/vcs-log/impl/resources/icons/CollapseBranches@2x_dark.png create mode 100755 platform/vcs-log/impl/resources/icons/CollapseBranches_dark.png create mode 100755 platform/vcs-log/impl/resources/icons/ExpandBranches.png create mode 100755 platform/vcs-log/impl/resources/icons/ExpandBranches@2x.png create mode 100755 platform/vcs-log/impl/resources/icons/ExpandBranches@2x_dark.png create mode 100755 platform/vcs-log/impl/resources/icons/ExpandBranches_dark.png create mode 100755 platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png create mode 100755 platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x.png create mode 100755 platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x_dark.png create mode 100755 platform/vcs-log/impl/resources/icons/ShowHideLongEdges_dark.png create mode 100644 platform/vcs-log/impl/src/icons/VcsLogIcons.java diff --git a/platform/vcs-log/impl/resources/icons/CollapseBranches.png b/platform/vcs-log/impl/resources/icons/CollapseBranches.png new file mode 100755 index 0000000000000000000000000000000000000000..c80e8d1c43b668fab98d60b81978d730d2b135d5 GIT binary patch literal 337 zcmV-X0j~auP)+v1>S%A zmGa^1cZLsNzJu7wP~r7JECXfBK>65R!2a>+HW*vv$w?UdA`oAPvabPgA5ItG01ZIg z3uX5~`Pf~cs;TYy=g%LAB#@013k}d%Xv7jIs0%eyVyMzf_EGVj~Gk~z5Ymz5a*bs=dplmHDpQKm_KvMD;nNM*nuwaV? jXfFH<#A$>K00=Mu`^ae2@0S~A00000NkvXXu0mjf$oPzZ literal 0 HcmV?d00001 diff --git a/platform/vcs-log/impl/resources/icons/CollapseBranches@2x.png b/platform/vcs-log/impl/resources/icons/CollapseBranches@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..4df8d3e58bc890b951663914c25fe8c583300d9c GIT binary patch literal 615 zcmV-t0+{`YP)HuOF zsL&oDu4wSlzn!0-&p-;8IB_BhpM{WynvECKfz$~g7C;gX0%9kioCT1+i9;*QXN>sF zC+L8mfBv?iSq=jrF_2s^0|kJf1AhGe>w-txjfsIWK-d9){^FJAqO}9Q|NgrN8t2%+ zE=nE1L_`!+1MvqSWvK?6yAH&MphBWpvR@+**8}k>AkIc}*i>i; zG?L{2DDWm!UP0-4w4k1ka0CNB%ZYM;qMDZapTGZ4u&{9m{QU>j#Kxfn6gx$r zE@+@iK{Q$y4Ewr(m?!|1_fA;S!3Q9&rnKOoW?g^|>XFI<28zl7BI^Ql%Nx*2Lh>Cz zWL<#E@&U2313|x*(B&QQxqs8LbOO z>jHvN2rBPEIqP)HuOF zsL&oDu4wSlzkTf3F$PkAm6a6=pOKIQYBpX_2T~`1SO87x0}xwyiGI6@Lo3W+Mtlxn zA>`tpfBv>%v77-a29gVApa2kbz>nX5UGPY|F;EByJK)b>23i7w4*352FDStU;gH_N zz`#V21DJ@2f@&cC0K^Pv7$jDWq;x(IbKxb{{~|S z+hR?c{S73g2|#=jh_$g8qY0HuAUO)auKf8Kl+~^S@gb;?C=jD(zeXUg2jWveoQ>wN zsn8H;B+CI%;7zE!g3|S9K|LSIfej=_0g0din=f%$PHG5j1>)C8Q9w*c;I*7+2N}B{}s!fB&CiXJu3R_m6=M zgh6bO7_^>XK(fdLYB@RpiJ3vw(5x;(4(R&5}?qh%Lo{2VfZR;rlOSE+Yd0z=SUF{@bsV z_g{Z9y!-kC#7>3^uLoioC|d@~$8NyyuOGMl{`QIC&$rJEMLMk8pu!h{_&St*4a&!E z01nUq#Jx~nEJ%KL9W-vjX*AUhcaK|CeNH-VY3WNXXVssA!!m*&LsqLwvp|u=@1znRo zp~CBdSO&_Lf%35%0LlyBe*F~!VQ9Vpfr~(V9m>82<&%^b8jvzn9}*wa08n0l=EA=~ loW_Ne)1k4@h^!tUzySR(QOpIuU_bx>002ovPDHLkV1jp4hbaI6 literal 0 HcmV?d00001 diff --git a/platform/vcs-log/impl/resources/icons/ExpandBranches@2x.png b/platform/vcs-log/impl/resources/icons/ExpandBranches@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..9273a6908a415a81176c474305dd291d86f7e20c GIT binary patch literal 611 zcmV-p0-XJcP)RCW=gltf`5eblM515ZhoLzHl0;PmcJ$?$YATiDO^X7PfI%yBx!fNk zO|ErXGTfH>)MMR)?= zrk(T{UQpdP*Xan7cE2+R;BCDm=)Jkn31J8trdNH9%oN zU7C5zPhgA0{#UTSNyc<(2Zrizm8R8-o2GdMZ37|w_}Th=g)+^PPwxbxKh8KY@V*GIwB6a&6xr1buf0Wd8$B zJ9dK*^!0zBk4_*wH66B0bI-47v-oUV)~yx@JVUoinVkb0z$<5&G2j$fl{$g(iD<;K zof}2f=IoXdM6i!KQZvvA$s>T3il5T^iSD7JghZk)z>Ig8q+}&ZUn05@x2(9Eb%9Q0 z$1%z#MmebecU?d`p)jYTcXSD{E+Dm_n-qflA|xZ)yxkCB?w??aQHuOF zsL&oDu4wSlzkTf3FYobAa(&%u7P9+Ff%jX`1$9b#jn5rj{@oMAPi+&tVy%KfuwXJH0w32au#lj3CmNrT8V(rn5Eyj; zDQUo+M6(%3qhQ#j0aD9>|HP;pje=oa4h*9Z&=luY{r&e}9Sbv)A-IL{_uqL|W~Tc< z=4~Wp>w!2Ih@apvMh1u{192d&`UU@?&8`|Co`TdW0(mkAh?{|!7uYXgq*cEF)Z*oV zHpxyRiJydu@nUNgQ?p;tfYdrRMiMtha$p0k`vu63U_c9<2C@<%s9yl2f^bOh!V-(< zj=*U-u~7hO`#a%Cgw;5bQ3JHx_=wMPq7osf?GNe$0P#8?{tU(Iu=ESiK_3to5i%bj ZzyN3e2s9|--NgU^002ovPDHLkV1npL`%VA= literal 0 HcmV?d00001 diff --git a/platform/vcs-log/impl/resources/icons/ExpandBranches_dark.png b/platform/vcs-log/impl/resources/icons/ExpandBranches_dark.png new file mode 100755 index 0000000000000000000000000000000000000000..b188f9b4d9ce81351c20625f0181f24a6efc2bef GIT binary patch literal 337 zcmV-X0j~auP)nj4_(MwogG13rBJh0J9{(p&;% zmmnL$gl@q5Z@*H2_&pH60pet+uptm@LD^bRK6V!{Gc#`kQV}3_z9!QysBi$1lE=t= z3r?Jg8BLR3}1i#nG3{{P&}7p7kv2s3z^GEvH|bE{Yqi{_h$tI12B}B zSd&RMK>F&sZ9u9G$_29RNizTn+M#p@E(MIp(Fh7WH1Ho=7)+cv5q~U@0!}z?tnjkshS8$cEI=Fe?bW@2#548+K0gJztup>2}dHVCe=J9 zQZ-0lU3cT>pMMsAzkfOL>-XR9APi!I#MY$Q-=KL2fPm7?4WO*n1jNixAyC2qia9dS z#Q{*jg{1!v-4Y=ZSc6`ukz)uG!vKR(2Mo9a@YaU;`T6+t{wFpOPMkQA;t(hU;(8K1 z22xv2t!x+#ZG6Cd*hqxs4bTvJ0>n!xNduswZ61>44Fp00W;rZM=0WQXvP0ku5T6HP zbL18o5thRMNbhM%Lf|tH`vUQG^kyNprXm{uI#lmxO0(f>XiMh_35oCtRL^T_l>;CH zory6Js>X#_2a{3|-2!4CApVF)%|~dk6WuZ literal 0 HcmV?d00001 diff --git a/platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x_dark.png b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x_dark.png new file mode 100755 index 0000000000000000000000000000000000000000..abf92c8943e17cfd4274f2bd9f5fd85720f90461 GIT binary patch literal 507 zcmVJNRCwBA{Qv(y!$1Nih5-gF(nS2XzO-zL>8MpC1oX5$5QAaw$W1<<5E0I@}jzrjtKhQQB1f7`HF z&Hxny$pzEY0Y85Kb-^R;M)NfAFaXkf znvxLs48*=bd>y@6h^?uJ#=j2L`g_!`>Mc|t-Wd;-<;np))m$UtXe41}t2A=bg9 z6hyax*awI|;!*Pv8tg<@&7_uur=ZQTUs&XRLFG=;x+vZU#9>&(!=Z9?sS7p&aSF7s x0pV02-azjL$y^{7g|g?+q%s;2)iFST0RX5*c@4AbnVJ9q002ovPDHLkV1f*w+b#eA literal 0 HcmV?d00001 diff --git a/platform/vcs-log/impl/resources/icons/ShowHideLongEdges_dark.png b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges_dark.png new file mode 100755 index 0000000000000000000000000000000000000000..0b1256fb16d8688eb4fc5dde3116380c4a6e15f5 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5XE_k{)hE&{2`t$$4J+o>9>vWgH)4Jz5Wa&+redodA{c|&z z`(&+;efX+w?Xg)UgyYCGrIW1k`~EvUGn(|K_51z0r5lV4*D$>L^Z&KHv(ZU5k(V3t zn1gZy-kD9}ZD=afxZCK>s9a>y#Kh10=eQVKSXfwrnJ{xJ!)(S*hdoSZs};T#t&q8A zAi(k{PUCEk3g0CerX%kh_ArWg?ucQSRKWbGKY-UjfJwC2`C89u?(~Kmtg9H=?3|9C y6A)%Q(RP3#>}<;=Mh|BRq1gpi3hWFl5)Anr7BT+Yv-bl1#^CAd=d#Wzp$PyW6>i}G literal 0 HcmV?d00001 diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java index 80319317196e..f44746b10f9d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java @@ -13,6 +13,7 @@ import com.intellij.vcs.log.data.VcsLogUiProperties; import com.intellij.vcs.log.ui.VcsLogUI; import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi; import com.intellij.vcs.log.ui.filter.VcsLogFilterUi; +import icons.VcsLogIcons; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -63,14 +64,14 @@ public class MainFrame { } private JComponent createActionsToolbar() { - AnAction hideBranchesAction = new DumbAwareAction("Collapse linear branches", "Collapse linear branches", AllIcons.Actions.Collapseall) { + AnAction hideBranchesAction = new DumbAwareAction("Collapse linear branches", "Collapse linear branches", VcsLogIcons.CollapseBranches) { @Override public void actionPerformed(AnActionEvent e) { myUI.hideAll(); } }; - AnAction showBranchesAction = new DumbAwareAction("Expand all branches", "Expand all branches", AllIcons.Actions.Expandall) { + AnAction showBranchesAction = new DumbAwareAction("Expand all branches", "Expand all branches", VcsLogIcons.ExpandBranches) { @Override public void actionPerformed(AnActionEvent e) { myUI.showAll(); @@ -91,7 +92,7 @@ public class MainFrame { AnAction showFullPatchAction = new ToggleAction("Show long edges", "Show long branch edges even if commits are invisible in the current view.", - AllIcons.Ide.UpDown) { + VcsLogIcons.ShowHideLongEdges) { @Override public boolean isSelected(AnActionEvent e) { return !myUI.areLongEdgesHidden(); diff --git a/platform/vcs-log/impl/src/icons/VcsLogIcons.java b/platform/vcs-log/impl/src/icons/VcsLogIcons.java new file mode 100644 index 000000000000..5e41d3f2a76e --- /dev/null +++ b/platform/vcs-log/impl/src/icons/VcsLogIcons.java @@ -0,0 +1,21 @@ +package icons; + +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + +/** + * NOTE THIS FILE IS AUTO-GENERATED + * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead + */ +public class VcsLogIcons { + + private static Icon load(String path) { + return IconLoader.getIcon(path, VcsLogIcons.class); + } + + public static final Icon CollapseBranches = load("/icons/CollapseBranches.png"); // 16x16 + public static final Icon ExpandBranches = load("/icons/ExpandBranches.png"); // 16x16 + public static final Icon ShowHideLongEdges = load("/icons/ShowHideLongEdges.png"); // 16x16 + +} diff --git a/platform/vcs-log/impl/vcs-log-impl.iml b/platform/vcs-log/impl/vcs-log-impl.iml index 97f5bdbb711a..b6bb13b512fd 100644 --- a/platform/vcs-log/impl/vcs-log-impl.iml +++ b/platform/vcs-log/impl/vcs-log-impl.iml @@ -6,6 +6,7 @@ + From 9e22d99155571d756d34eafb2f57d632177b8971 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 19:07:34 +0400 Subject: [PATCH 31/43] [log] invokeLater only if needed It fixes too long collaps of a linear branch. The performance problem happened because after the branch was collapsed we jumped to the commit not immediately, but Later, which happened after JTable repaint. The repaint on the other hand tried to guess the area to repaint, but didn't succeed because we were staying in the invalid area, in which case repaint was called for the whole table (see BasicTableUI.paint "if (rMin == -1)..." --- .../vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java index 05de16622caa..c3ae7193e78b 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java @@ -68,7 +68,7 @@ public class VcsLogUI { } public void jumpToRow(final int rowIndex) { - ApplicationManager.getApplication().invokeLater(new Runnable() { + UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { myMainFrame.getGraphTable().jumpToRow(rowIndex); @@ -93,7 +93,7 @@ public class VcsLogUI { } public void addToSelection(final Hash hash) { - ApplicationManager.getApplication().invokeLater(new Runnable() { + UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { int row = myLogDataHolder.getDataPack().getRowByHash(hash); From 843a2a56fa6aca5028160b996e9c5d9a913c383e Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 19:15:37 +0400 Subject: [PATCH 32/43] [log] IDEA-115370 Execute potentially slow tasks under modal progress --- .../intellij/vcs/log/data/VcsLogFilterer.java | 22 +++++--- .../src/com/intellij/vcs/log/ui/VcsLogUI.java | 53 +++++++++++++++---- .../log/ui/filter/VcsLogClassicFilterUi.java | 7 ++- .../vcs/log/ui/frame/BranchesPanel.java | 2 +- 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java index d0a2b5103b22..a13ffb30eb4b 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java @@ -4,6 +4,7 @@ import com.intellij.openapi.util.Condition; import com.intellij.util.Consumer; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.ui.UIUtil; import com.intellij.vcs.log.VcsFullCommitDetails; import com.intellij.vcs.log.VcsLogFilter; import com.intellij.vcs.log.graph.elements.Node; @@ -52,7 +53,7 @@ public class VcsLogFilterer { } // apply details filters, and use simple table without graph (we can't filter by details and keep the graph yet). - AbstractVcsLogTableModel model; + final AbstractVcsLogTableModel model; if (!detailsFilters.isEmpty()) { List filteredCommits = filterByDetails(graphModel, detailsFilters); model = new NoGraphTableModel(myUI, filteredCommits, myLogDataHolder.getDataPack().getRefsModel(), true); @@ -61,12 +62,21 @@ public class VcsLogFilterer { model = new GraphTableModel(myLogDataHolder, myUI); } - myUI.setModel(model); - myUI.updateUI(); + updateUi(model); + } - if (model.getRowCount() == 0) { - model.requestToLoadMore(); - } + private void updateUi(final AbstractVcsLogTableModel model) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + myUI.setModel(model); + myUI.updateUI(); + + if (model.getRowCount() == 0) { + model.requestToLoadMore(); + } + } + }); } public void requestVcs(@NotNull Collection filters, final Runnable onSuccess) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java index c3ae7193e78b..db6cf54c8b73 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java @@ -1,7 +1,7 @@ package com.intellij.vcs.log.ui; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.ui.table.JBTable; import com.intellij.util.ui.UIUtil; @@ -24,6 +24,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.table.TableModel; import java.util.Collection; +import java.util.concurrent.CountDownLatch; /** * @author erokhins @@ -103,15 +104,25 @@ public class VcsLogUI { } public void showAll() { - myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().showAll(); - updateUI(); - jumpToRow(0); + runUnderModalProgress("Expanding linear branches...", new Runnable() { + @Override + public void run() { + myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().showAll(); + updateUI(); + jumpToRow(0); + } + }); } public void hideAll() { - myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().hideAll(); - updateUI(); - jumpToRow(0); + runUnderModalProgress("Collapsing linear branches...", new Runnable() { + @Override + public void run() { + myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().hideAll(); + updateUI(); + jumpToRow(0); + } + }); } public void setLongEdgeVisibility(boolean visibility) { @@ -176,10 +187,23 @@ public class VcsLogUI { jumpToRow(row); } else { - myLogDataHolder.showFullLog(new Runnable() { + runUnderModalProgress("Building graph...", new Runnable() { @Override public void run() { - jumpToCommit(commitHash); + final CountDownLatch waiter = new CountDownLatch(1); + myLogDataHolder.showFullLog(new Runnable() { + @Override + public void run() { + waiter.countDown(); + jumpToCommit(commitHash); + } + }); + try { + waiter.await(); + } + catch (InterruptedException e) { + LOG.error(e); + } } }); } @@ -201,7 +225,11 @@ public class VcsLogUI { } public void applyFiltersAndUpdateUi() { - myFilterer.applyFiltersAndUpdateUi(collectFilters()); + runUnderModalProgress("Applying filters...", new Runnable() { + public void run() { + myFilterer.applyFiltersAndUpdateUi(collectFilters()); + } + }); } @NotNull @@ -222,4 +250,9 @@ public class VcsLogUI { public Project getProject() { return myProject; } + + public void runUnderModalProgress(@NotNull String task, @NotNull Runnable runnable) { + ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, task, false, null, this.getMainFrame().getMainComponent()); + } + } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java index 2a45d45b0b0b..efc01b969aee 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java @@ -21,7 +21,6 @@ import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import com.intellij.vcs.log.VcsLogFilter; -import com.intellij.vcs.log.data.VcsLogFilterer; import com.intellij.vcs.log.ui.VcsLogUI; import org.jetbrains.annotations.NotNull; @@ -36,13 +35,13 @@ import java.util.List; */ public class VcsLogClassicFilterUi implements VcsLogFilterUi { - @NotNull private final VcsLogFilterer myFilterer; @NotNull private final JComponent myRootPanel; @NotNull private final List myFilterPopupComponents; @NotNull private final SearchTextField myTextFilter; + @NotNull private final VcsLogUI myUi; public VcsLogClassicFilterUi(@NotNull VcsLogUI ui) { - myFilterer = ui.getFilterer(); + myUi = ui; JLabel filterCaption = new JLabel("Filter:"); filterCaption.setForeground(UIUtil.isUnderDarcula() ? UIUtil.getLabelForeground() : UIUtil.getInactiveTextColor()); @@ -97,7 +96,7 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi { } void applyFilters() { - myFilterer.applyFiltersAndUpdateUi(getFilters()); + myUi.applyFiltersAndUpdateUi(); } } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/BranchesPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/BranchesPanel.java index 3b4d0f477a3e..70dad0732dba 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/BranchesPanel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/BranchesPanel.java @@ -232,10 +232,10 @@ public class BranchesPanel extends JPanel { } private void jumpToSelectedRef() { + myPopup.cancel(); // close the popup immediately not to stay at the front if jumping to a commits takes long time. VcsRef selectedRef = (VcsRef)myList.getSelectedValue(); if (selectedRef != null) { myUi.jumpToCommit(selectedRef.getCommitHash()); - myPopup.cancel(); } } } From f317edefa09f4424c3c5c34f7b551769527d65f8 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 19:22:31 +0400 Subject: [PATCH 33/43] [log] Don't allow the graph table to repaint during graph modification Introduce executeWithoutRepaint() which freezes the repaint while executing the given task. Otherwise it may lead to a performance disaster: the graph will change, and current visible area will be not in the invalid table area, which will lead to the full table repaint (which in turn will lead to call getValueAt on all table rows). --- .../intellij/vcs/log/data/VcsLogFilterer.java | 26 +++++++++++++------ .../src/com/intellij/vcs/log/ui/VcsLogUI.java | 18 ++++++++----- .../vcs/log/ui/frame/VcsLogGraphTable.java | 23 ++++++++++++++++ 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java index a13ffb30eb4b..769b814ad77d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFilterer.java @@ -36,7 +36,7 @@ public class VcsLogFilterer { } public void applyFiltersAndUpdateUi(@NotNull Collection filters) { - GraphModel graphModel = myLogDataHolder.getDataPack().getGraphModel(); + final GraphModel graphModel = myLogDataHolder.getDataPack().getGraphModel(); List graphFilters = ContainerUtil.findAll(filters, VcsLogGraphFilter.class); List detailsFilters = ContainerUtil.findAll(filters, VcsLogDetailsFilter.class); @@ -49,7 +49,12 @@ public class VcsLogFilterer { applyGraphFilters(graphModel, graphFilters); } else { - graphModel.setVisibleBranchesNodes(ALL_NODES_VISIBLE); + myUI.getTable().executeWithoutRepaint(new Runnable() { + @Override + public void run() { + graphModel.setVisibleBranchesNodes(ALL_NODES_VISIBLE); + } + }); } // apply details filters, and use simple table without graph (we can't filter by details and keep the graph yet). @@ -90,14 +95,19 @@ public class VcsLogFilterer { }); } - private static void applyGraphFilters(GraphModel graphModel, final List onGraphFilters) { - graphModel.setVisibleBranchesNodes(new Function() { + private void applyGraphFilters(final GraphModel graphModel, final List onGraphFilters) { + myUI.getTable().executeWithoutRepaint(new Runnable() { @Override - public Boolean fun(final Node node) { - return !ContainerUtil.exists(onGraphFilters, new Condition() { + public void run() { + graphModel.setVisibleBranchesNodes(new Function() { @Override - public boolean value(VcsLogGraphFilter filter) { - return !filter.matches(node.getCommitHash()); + public Boolean fun(final Node node) { + return !ContainerUtil.exists(onGraphFilters, new Condition() { + @Override + public boolean value(VcsLogGraphFilter filter) { + return !filter.matches(node.getCommitHash()); + } + }); } }); } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java index db6cf54c8b73..b57750090e21 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java @@ -3,7 +3,6 @@ package com.intellij.vcs.log.ui; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; -import com.intellij.ui.table.JBTable; import com.intellij.util.ui.UIUtil; import com.intellij.vcs.log.Hash; import com.intellij.vcs.log.VcsLogFilter; @@ -19,6 +18,7 @@ import com.intellij.vcs.log.graphmodel.FragmentManager; import com.intellij.vcs.log.graphmodel.GraphFragment; import com.intellij.vcs.log.printmodel.SelectController; import com.intellij.vcs.log.ui.frame.MainFrame; +import com.intellij.vcs.log.ui.frame.VcsLogGraphTable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -156,18 +156,24 @@ public class VcsLogUI { public void click(@Nullable GraphElement graphElement) { SelectController selectController = myLogDataHolder.getDataPack().getPrintCellModel().getSelectController(); - FragmentManager fragmentController = myLogDataHolder.getDataPack().getGraphModel().getFragmentManager(); + final FragmentManager fragmentController = myLogDataHolder.getDataPack().getGraphModel().getFragmentManager(); selectController.deselectAll(); if (graphElement == null) { return; } - GraphFragment fragment = fragmentController.relateFragment(graphElement); + final GraphFragment fragment = fragmentController.relateFragment(graphElement); if (fragment == null) { return; } - UpdateRequest updateRequest = fragmentController.changeVisibility(fragment); + + myMainFrame.getGraphTable().executeWithoutRepaint(new Runnable() { + @Override + public void run() { + UpdateRequest updateRequest = fragmentController.changeVisibility(fragment); + jumpToRow(updateRequest.from()); + } + }); updateUI(); - jumpToRow(updateRequest.from()); } public void click(int rowIndex) { @@ -237,7 +243,7 @@ public class VcsLogUI { return myMainFrame.getFilterUi().getFilters(); } - public JBTable getTable() { + public VcsLogGraphTable getTable() { return myMainFrame.getGraphTable(); } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java index 8d6e1a614f78..0864a4098a21 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java @@ -53,6 +53,8 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C @NotNull private final VcsLogUI myUI; @NotNull private final GraphCellPainter myGraphPainter = new SimpleGraphCellPainter(); + private volatile boolean myRepaintFreezed; + public VcsLogGraphTable(@NotNull VcsLogUI UI, final VcsLogDataHolder logDataHolder) { super(); myUI = UI; @@ -103,6 +105,27 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C scrollRectToVisible(getCellRect(rowIndex, 0, false)); } + @Override + protected void paintComponent(Graphics g) { + if (myRepaintFreezed) { + return; + } + super.paintComponent(g); + } + + /** + * Freeze repaint to avoid repainting during changing the Graph. + */ + public void executeWithoutRepaint(@NotNull Runnable action) { + myRepaintFreezed = true; + try { + action.run(); + } + finally { + myRepaintFreezed = false; + } + } + @Nullable public GraphPrintCell getGraphPrintCellForRow(TableModel model, int rowIndex) { if (rowIndex >= model.getRowCount()) { From 6377dc26e31c08bfef79d23f4be7c1ad76dfef31 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 19:32:20 +0400 Subject: [PATCH 34/43] [log] Allow null roots in the GraphTableModel. Some rows may be empty (contain no commits): for instance, in the case of graph filtered by branch, when there will be just graph fragments drawn. Therefore it is not an error to have a null node, and therefore it is not an error to receive the FAKE_ROOT in the color manager. Supply correct root to the LoadingDetails (the root is known because is taken from the Branch of a Node). --- .../impl/src/com/intellij/vcs/log/data/DataGetter.java | 4 ++-- .../src/com/intellij/vcs/log/data/LoadingDetails.java | 7 +++---- .../com/intellij/vcs/log/ui/VcsLogColorManagerImpl.java | 4 ++++ .../vcs/log/ui/tables/AbstractVcsLogTableModel.java | 2 +- .../com/intellij/vcs/log/ui/tables/GraphTableModel.java | 8 +------- .../com/intellij/vcs/log/ui/tables/NoGraphTableModel.java | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/DataGetter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/DataGetter.java index 8105e758d292..dca343bed358 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/DataGetter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/DataGetter.java @@ -80,7 +80,7 @@ public abstract class DataGetter implements Dis @NotNull private T loadingDetails(Node node, Hash hash) { TaskDescriptor descriptor = runLoadAroundCommitData(node); - T loadingDetails = (T)new LoadingDetails(hash, descriptor.getTaskNum()); + T loadingDetails = (T)new LoadingDetails(hash, descriptor.getTaskNum(), node.getBranch().getRepositoryRoot()); return loadingDetails; } @@ -145,7 +145,7 @@ public abstract class DataGetter implements Dis // fill the cache with temporary "Loading" values to avoid producing queries for each commit that has not been cached yet, // even if it will be loaded within a previous query if (!myCache.isKeyCached(hash)) { - myCache.put(hash, (T)new LoadingDetails(hash, taskNumber)); + myCache.put(hash, (T)new LoadingDetails(hash, taskNumber, commitNode.getBranch().getRepositoryRoot())); } } } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/LoadingDetails.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/LoadingDetails.java index e907a47f8585..11db6c8db62b 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/LoadingDetails.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/LoadingDetails.java @@ -1,9 +1,9 @@ package com.intellij.vcs.log.data; import com.intellij.openapi.vcs.changes.Change; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.vcs.log.Hash; import com.intellij.vcs.log.impl.VcsFullCommitDetailsImpl; -import com.intellij.vcs.log.ui.tables.AbstractVcsLogTableModel; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -18,9 +18,8 @@ public class LoadingDetails extends VcsFullCommitDetailsImpl { private final long myLoadingTaskIndex; - public LoadingDetails(@NotNull Hash hash, long loadingTaskIndex) { - super(hash, Collections.emptyList(), -1, AbstractVcsLogTableModel.UNKNOWN_ROOT, - "Loading...", "", "", "", "", "", -1, Collections.emptyList()); + public LoadingDetails(@NotNull Hash hash, long loadingTaskIndex, @NotNull VirtualFile root) { + super(hash, Collections.emptyList(), -1, root, "Loading...", "", "", "", "", "", -1, Collections.emptyList()); myLoadingTaskIndex = loadingTaskIndex; } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogColorManagerImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogColorManagerImpl.java index 43d678da496d..27acafd31052 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogColorManagerImpl.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogColorManagerImpl.java @@ -5,6 +5,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.JBColor; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; +import com.intellij.vcs.log.ui.tables.AbstractVcsLogTableModel; import org.jetbrains.annotations.NotNull; import java.awt.*; @@ -51,6 +52,9 @@ public class VcsLogColorManagerImpl implements VcsLogColorManager { @NotNull @Override public Color getRootColor(@NotNull VirtualFile root) { + if (root == AbstractVcsLogTableModel.FAKE_ROOT) { + return UIUtil.getTableBackground(); + } Color color = myRoots2Colors.get(root); if (color == null) { LOG.error("No color record for root " + root + ". All roots: " + myRoots2Colors); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/AbstractVcsLogTableModel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/AbstractVcsLogTableModel.java index dcde63dd09fa..bee2ed6e0ef7 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/AbstractVcsLogTableModel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/AbstractVcsLogTableModel.java @@ -17,7 +17,7 @@ import java.util.List; */ public abstract class AbstractVcsLogTableModel extends AbstractTableModel { - public static final VirtualFile UNKNOWN_ROOT = NullVirtualFile.INSTANCE; + public static final VirtualFile FAKE_ROOT = NullVirtualFile.INSTANCE; public static final int ROOT_COLUMN = 0; public static final int COMMIT_COLUMN = 1; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java index 406d4c4fa82c..8cd09242275d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/GraphTableModel.java @@ -100,13 +100,7 @@ public class GraphTableModel extends AbstractVcsLogTableModel { @Override protected VirtualFile getRoot(int rowIndex) { Node commitNode = myDataPack.getGraphModel().getGraph().getCommitNodeInRow(rowIndex); - if (commitNode != null) { - return commitNode.getBranch().getRepositoryRoot(); - } - else { - LOG.error("Couldn't identify commit node at " + rowIndex); - return UNKNOWN_ROOT; - } + return commitNode != null ? commitNode.getBranch().getRepositoryRoot() : FAKE_ROOT; } @NotNull diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/NoGraphTableModel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/NoGraphTableModel.java index 3ce91ac69d4e..f39d548edd3d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/NoGraphTableModel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/tables/NoGraphTableModel.java @@ -84,7 +84,7 @@ public class NoGraphTableModel extends AbstractVcsLogTableModel { } else { LOG.error("Couldn't identify root for commit at " + rowIndex, new Attachment("loaded_commits", myCommits.toString())); - return UNKNOWN_ROOT; + return FAKE_ROOT; } } From 633f1c73b0b20eaea700cbcb0338eb20f65460d3 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 20:07:13 +0400 Subject: [PATCH 35/43] [git] Don't print git log --tags command output to the log & console --- plugins/git4idea/src/git4idea/log/GitLogProvider.java | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git4idea/src/git4idea/log/GitLogProvider.java b/plugins/git4idea/src/git4idea/log/GitLogProvider.java index 7cc7f671d5e1..1f3e7230f34d 100644 --- a/plugins/git4idea/src/git4idea/log/GitLogProvider.java +++ b/plugins/git4idea/src/git4idea/log/GitLogProvider.java @@ -132,6 +132,7 @@ public class GitLogProvider implements VcsLogProvider { // TODO this is to be removed when tags will be supported by the GitRepositoryReader private Collection readTags(@NotNull VirtualFile root) throws VcsException { GitSimpleHandler tagHandler = new GitSimpleHandler(myProject, root, GitCommand.LOG); + tagHandler.setSilent(true); tagHandler.addParameters("--tags", "--no-walk", "--format=%H%d" + GitLogParser.RECORD_START_GIT, "--decorate=full"); String out = tagHandler.run(); Collection refs = new ArrayList(); From d59d5f264cf7e07322356bb45a179c47e4121055 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 20:15:59 +0400 Subject: [PATCH 36/43] [log] toString() --- .../com/intellij/vcs/log/impl/VcsShortCommitDetailsImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsShortCommitDetailsImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsShortCommitDetailsImpl.java index 7c1c2824ac57..e99e81473109 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsShortCommitDetailsImpl.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsShortCommitDetailsImpl.java @@ -61,4 +61,9 @@ public class VcsShortCommitDetailsImpl implements VcsShortCommitDetails { return myAuthorName; } + @Override + public String toString() { + return getHash().toShortString() + "(" + getSubject() + ")"; + } + } From 0af73afd9b92ed8e0332594ce69966945e756d2d Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 Oct 2013 21:05:47 +0400 Subject: [PATCH 37/43] [log] log the error only once per request --- .../com/intellij/vcs/log/data/VcsLogDataHolder.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java index 050a51d7b072..6a1dd0ddb50e 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java @@ -704,6 +704,7 @@ public class VcsLogDataHolder implements Disposable { @NotNull public Collection getTopCommitDetails() { final Collection topCommits = getTopCommits(); + final AtomicBoolean errorDetailsAttached = new AtomicBoolean(); return ContainerUtil.mapNotNull(topCommits, new Function() { @Nullable @Override @@ -715,9 +716,14 @@ public class VcsLogDataHolder implements Disposable { } // shouldn't happen - LOG.error("No details were stored for commit " + hash, - new Attachment("details_cache.txt", myTopCommitsDetailsCache.toString()), - new Attachment("top_commits.txt", topCommits.toString())); + String errorMessage = "No details were stored for commit " + hash; + // log the error only once for the getTopCommitDetails request + if (!errorDetailsAttached.get()) { + errorDetailsAttached.set(true); + LOG.error(errorMessage, + new Attachment("details_cache.txt", myTopCommitsDetailsCache.toString()), + new Attachment("top_commits.txt", topCommits.toString())); + } return null; } }); From 4cfc28593bd49f7446b16b51fdfb68816df9ddd1 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Tue, 29 Oct 2013 18:42:01 +0100 Subject: [PATCH 38/43] IDEA-115583 exception on CTRL+SHiFT+A on welcome screen --- .../src/com/intellij/util/indexing/FindSymbolParameters.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/indexing-impl/src/com/intellij/util/indexing/FindSymbolParameters.java b/platform/indexing-impl/src/com/intellij/util/indexing/FindSymbolParameters.java index 71591b2cdaae..3ec039b8a5e8 100644 --- a/platform/indexing-impl/src/com/intellij/util/indexing/FindSymbolParameters.java +++ b/platform/indexing-impl/src/com/intellij/util/indexing/FindSymbolParameters.java @@ -16,6 +16,7 @@ package com.intellij.util.indexing; import com.intellij.openapi.project.Project; +import com.intellij.psi.search.EverythingGlobalScope; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.ProjectScope; import org.jetbrains.annotations.NotNull; @@ -60,6 +61,7 @@ public class FindSymbolParameters { } public static GlobalSearchScope searchScopeFor(Project project, boolean searchInLibraries) { + if (project == null) return new EverythingGlobalScope(); return searchInLibraries? ProjectScope.getAllScope(project) : ProjectScope.getProjectScope(project); } From ed14625bca3eef79a801b1c19b12b310382cf766 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 29 Oct 2013 18:35:41 +0100 Subject: [PATCH 39/43] init WEB-6413 sourcemap backed breakpoints do not work until page is loaded --- xml/impl/src/com/intellij/ide/browsers/UrlImpl.java | 4 ++++ xml/impl/src/com/intellij/ide/browsers/Urls.java | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/xml/impl/src/com/intellij/ide/browsers/UrlImpl.java b/xml/impl/src/com/intellij/ide/browsers/UrlImpl.java index 0e4621cd87d9..ee64ea7a1e00 100644 --- a/xml/impl/src/com/intellij/ide/browsers/UrlImpl.java +++ b/xml/impl/src/com/intellij/ide/browsers/UrlImpl.java @@ -23,6 +23,10 @@ public final class UrlImpl implements Url { private String externalFormWithoutParameters; + public UrlImpl(@NotNull String scheme, @Nullable String authority, @Nullable String path) { + this(null, scheme, authority, path, null); + } + public UrlImpl(@Nullable String raw, @NotNull String scheme, @Nullable String authority, @Nullable String path, @Nullable String parameters) { this.raw = raw; this.scheme = scheme; diff --git a/xml/impl/src/com/intellij/ide/browsers/Urls.java b/xml/impl/src/com/intellij/ide/browsers/Urls.java index b9626dac7c6c..140627fb6980 100644 --- a/xml/impl/src/com/intellij/ide/browsers/Urls.java +++ b/xml/impl/src/com/intellij/ide/browsers/Urls.java @@ -32,6 +32,11 @@ public final class Urls { return result; } + @NotNull + public static Url newHttpUrl(@Nullable String authority, @Nullable String path) { + return new UrlImpl("http", authority, path); + } + @Nullable public static Url parse(@NotNull String url, boolean asLocalIfNoScheme) { if (asLocalIfNoScheme && !URLUtil.containsScheme(url)) { @@ -101,7 +106,7 @@ public final class Urls { public static Url newFromVirtualFile(@NotNull VirtualFile file) { String path = file.getPath(); if (file.isInLocalFileSystem()) { - return new UrlImpl(null, file.getFileSystem().getProtocol(), null, path, null); + return new UrlImpl(file.getFileSystem().getProtocol(), null, path); } else { return parseUrl(file.getUrl(), false); From 491951028d402eb39f9e404ec3c5d3c5a8b7f956 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 29 Oct 2013 17:51:44 +0100 Subject: [PATCH 40/43] target 1.5 also for testng (IDEA-115618) --- .idea/compiler.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 378ae8bb7c97..c5db8fc58229 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -33,6 +33,7 @@ + From 6c1b0cc646212d79d8542c83e0e20a76a3806ba1 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 29 Oct 2013 18:23:49 +0100 Subject: [PATCH 41/43] move XML highlighters to xml-psi --- .../SingleLazyInstanceSyntaxHighlighterFactory.java | 0 .../intellij/openapi/editor/XmlHighlighterColors.java | 0 .../intellij/ide/highlighter/HtmlFileHighlighter.java | 6 +++--- .../ide/highlighter/HtmlHighlighterFactory.java | 0 .../intellij/ide/highlighter/XmlFileHighlighter.java | 0 .../ide/highlighter/XmlHighlighterFactory.java | 0 .../intellij/lang/dtd/DtdSyntaxHighlighterFactory.java | 0 .../lang/html/HtmlSyntaxHighlighterFactory.java | 0 .../lang/xhtml/XhtmlSyntaxHighlighterFactory.java | 0 .../intellij/lang/xml/XmlSyntaxHighlighterFactory.java | 0 .../src/com/intellij/lexer/XHtmlHighlightingLexer.java | 4 ++-- .../src/com/intellij/lexer/XmlHighlightingLexer.java | 0 .../src/com/intellij/xml/XmlCoreEnvironment.java | 10 ++++++++++ 13 files changed, 15 insertions(+), 5 deletions(-) rename platform/{platform-api => editor-ui-api}/src/com/intellij/openapi/fileTypes/SingleLazyInstanceSyntaxHighlighterFactory.java (100%) rename xml/{openapi => xml-psi-api}/src/com/intellij/openapi/editor/XmlHighlighterColors.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java (95%) rename xml/{impl => xml-psi-impl}/src/com/intellij/ide/highlighter/HtmlHighlighterFactory.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/ide/highlighter/XmlFileHighlighter.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/ide/highlighter/XmlHighlighterFactory.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java (100%) rename xml/{impl => xml-psi-impl}/src/com/intellij/lexer/XHtmlHighlightingLexer.java (87%) rename xml/{impl => xml-psi-impl}/src/com/intellij/lexer/XmlHighlightingLexer.java (100%) diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/SingleLazyInstanceSyntaxHighlighterFactory.java b/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SingleLazyInstanceSyntaxHighlighterFactory.java similarity index 100% rename from platform/platform-api/src/com/intellij/openapi/fileTypes/SingleLazyInstanceSyntaxHighlighterFactory.java rename to platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SingleLazyInstanceSyntaxHighlighterFactory.java diff --git a/xml/openapi/src/com/intellij/openapi/editor/XmlHighlighterColors.java b/xml/xml-psi-api/src/com/intellij/openapi/editor/XmlHighlighterColors.java similarity index 100% rename from xml/openapi/src/com/intellij/openapi/editor/XmlHighlighterColors.java rename to xml/xml-psi-api/src/com/intellij/openapi/editor/XmlHighlighterColors.java diff --git a/xml/impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java similarity index 95% rename from xml/impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java rename to xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java index dd9ea6556b25..9f8510bd6f9e 100644 --- a/xml/impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java @@ -20,7 +20,7 @@ import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.HighlighterColors; import com.intellij.openapi.editor.XmlHighlighterColors; import com.intellij.openapi.editor.colors.TextAttributesKey; -import com.intellij.openapi.fileTypes.FileTypeManager; +import com.intellij.openapi.fileTypes.FileTypeRegistry; import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; import com.intellij.psi.tree.IElementType; import com.intellij.psi.xml.XmlTokenType; @@ -84,13 +84,13 @@ public class HtmlFileHighlighter extends SyntaxHighlighterBase { @Override @NotNull public Lexer getHighlightingLexer() { - return new HtmlHighlightingLexer(FileTypeManager.getInstance().getStdFileType("CSS")); + return new HtmlHighlightingLexer(FileTypeRegistry.getInstance().findFileTypeByName("CSS")); } @Override @NotNull public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { - return pack(XmlHighlighterColors.HTML_CODE, pack(keys1.get(tokenType), keys2.get(tokenType))); + return SyntaxHighlighterBase.pack(XmlHighlighterColors.HTML_CODE, pack(keys1.get(tokenType), keys2.get(tokenType))); } public static final void registerEmbeddedTokenAttributes(Map _keys1, diff --git a/xml/impl/src/com/intellij/ide/highlighter/HtmlHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlHighlighterFactory.java similarity index 100% rename from xml/impl/src/com/intellij/ide/highlighter/HtmlHighlighterFactory.java rename to xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlHighlighterFactory.java diff --git a/xml/impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java similarity index 100% rename from xml/impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java rename to xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java diff --git a/xml/impl/src/com/intellij/ide/highlighter/XmlHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlHighlighterFactory.java similarity index 100% rename from xml/impl/src/com/intellij/ide/highlighter/XmlHighlighterFactory.java rename to xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlHighlighterFactory.java diff --git a/xml/impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java similarity index 100% rename from xml/impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java rename to xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java diff --git a/xml/impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java similarity index 100% rename from xml/impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java rename to xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java diff --git a/xml/impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java similarity index 100% rename from xml/impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java rename to xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java diff --git a/xml/impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java similarity index 100% rename from xml/impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java rename to xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java diff --git a/xml/impl/src/com/intellij/lexer/XHtmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlHighlightingLexer.java similarity index 87% rename from xml/impl/src/com/intellij/lexer/XHtmlHighlightingLexer.java rename to xml/xml-psi-impl/src/com/intellij/lexer/XHtmlHighlightingLexer.java index c71924b78ce9..c4f7efb80dd2 100644 --- a/xml/impl/src/com/intellij/lexer/XHtmlHighlightingLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlHighlightingLexer.java @@ -15,7 +15,7 @@ */ package com.intellij.lexer; -import com.intellij.openapi.fileTypes.FileTypeManager; +import com.intellij.openapi.fileTypes.FileTypeRegistry; public class XHtmlHighlightingLexer extends HtmlHighlightingLexer { public XHtmlHighlightingLexer() { @@ -23,7 +23,7 @@ public class XHtmlHighlightingLexer extends HtmlHighlightingLexer { } public XHtmlHighlightingLexer(Lexer baseLexer) { - super(baseLexer,false, FileTypeManager.getInstance().getStdFileType("CSS")); + super(baseLexer,false, FileTypeRegistry.getInstance().findFileTypeByName("CSS")); } @Override diff --git a/xml/impl/src/com/intellij/lexer/XmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java similarity index 100% rename from xml/impl/src/com/intellij/lexer/XmlHighlightingLexer.java rename to xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java diff --git a/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java b/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java index cdf33c39eed7..5ae81dd96174 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java @@ -12,15 +12,20 @@ import com.intellij.lang.LanguageASTFactory; import com.intellij.lang.LanguageParserDefinitions; import com.intellij.lang.dtd.DTDLanguage; import com.intellij.lang.dtd.DTDParserDefinition; +import com.intellij.lang.dtd.DtdSyntaxHighlighterFactory; import com.intellij.lang.html.HTMLLanguage; import com.intellij.lang.html.HTMLParserDefinition; +import com.intellij.lang.html.HtmlSyntaxHighlighterFactory; import com.intellij.lang.xhtml.XHTMLLanguage; import com.intellij.lang.xhtml.XHTMLParserDefinition; +import com.intellij.lang.xhtml.XhtmlSyntaxHighlighterFactory; import com.intellij.lang.xml.XMLLanguage; import com.intellij.lang.xml.XMLParserDefinition; import com.intellij.lang.xml.XmlASTFactory; +import com.intellij.lang.xml.XmlSyntaxHighlighterFactory; import com.intellij.lexer.HtmlEmbeddedTokenTypesProvider; import com.intellij.openapi.extensions.Extensions; +import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.psi.impl.cache.impl.id.IdIndexers; import com.intellij.psi.impl.cache.impl.idCache.XmlIdIndexer; import com.intellij.psi.impl.source.xml.XmlElementDescriptorProvider; @@ -43,6 +48,11 @@ public class XmlCoreEnvironment { appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml"); + SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XMLLanguage.INSTANCE, new XmlSyntaxHighlighterFactory()); + SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(DTDLanguage.INSTANCE, new DtdSyntaxHighlighterFactory()); + SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(HTMLLanguage.INSTANCE, new HtmlSyntaxHighlighterFactory()); + SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XHTMLLanguage.INSTANCE, new XhtmlSyntaxHighlighterFactory()); + appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition()); appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition()); appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition()); From 2d080ba892dd2c14f65625dfd3b8c2308f3bff42 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 29 Oct 2013 18:36:19 +0100 Subject: [PATCH 42/43] to make programmatic registration easier, use explicit ExtensionPointName instance in extension points that use KeyedExtensionFactory --- .../openapi/fileTypes/FileTypeExtensionFactory.java | 4 +++- .../com/intellij/openapi/fileTypes/SyntaxHighlighter.java | 6 +++++- .../com/intellij/openapi/util/KeyedExtensionFactory.java | 5 +++-- .../intellij/openapi/roots/ui/OrderRootTypeUIFactory.java | 5 ++++- .../intellij/ide/structureView/StructureViewBuilder.java | 6 +++++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtensionFactory.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtensionFactory.java index 2378fd53c2f2..a65aff0c91ee 100644 --- a/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtensionFactory.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtensionFactory.java @@ -20,12 +20,14 @@ package com.intellij.openapi.fileTypes; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.extensions.KeyedFactoryEPBean; import com.intellij.openapi.util.KeyedExtensionFactory; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; public class FileTypeExtensionFactory extends KeyedExtensionFactory { - public FileTypeExtensionFactory(@NotNull final Class interfaceClass, @NonNls @NotNull final String epName) { + public FileTypeExtensionFactory(@NotNull final Class interfaceClass, @NonNls @NotNull final ExtensionPointName epName) { super(interfaceClass, epName, ApplicationManager.getApplication().getPicoContainer()); } diff --git a/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighter.java b/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighter.java index d6c7dc3c73d1..700bf852d367 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighter.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighter.java @@ -17,6 +17,8 @@ package com.intellij.openapi.fileTypes; import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.extensions.KeyedFactoryEPBean; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; @@ -27,13 +29,15 @@ import org.jetbrains.annotations.NotNull; * @see SyntaxHighlighterFactory#getSyntaxHighlighter(com.intellij.lang.Language, com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile) */ public interface SyntaxHighlighter { + ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.syntaxHighlighter"); + /** * @deprecated * @see SyntaxHighlighterFactory#getSyntaxHighlighter(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile) * @see SyntaxHighlighterFactory#getSyntaxHighlighter(com.intellij.lang.Language, com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile) */ SyntaxHighlighterProvider PROVIDER = - new FileTypeExtensionFactory(SyntaxHighlighterProvider.class, "com.intellij.syntaxHighlighter").get(); + new FileTypeExtensionFactory(SyntaxHighlighterProvider.class, EP_NAME).get(); /** * Returns the lexer used for highlighting the file. The lexer is invoked incrementally when the file is changed, so it must be diff --git a/platform/extensions/src/com/intellij/openapi/util/KeyedExtensionFactory.java b/platform/extensions/src/com/intellij/openapi/util/KeyedExtensionFactory.java index e91e86433a37..054cfe0d7f19 100644 --- a/platform/extensions/src/com/intellij/openapi/util/KeyedExtensionFactory.java +++ b/platform/extensions/src/com/intellij/openapi/util/KeyedExtensionFactory.java @@ -34,9 +34,10 @@ public abstract class KeyedExtensionFactory { private final ExtensionPointName myEpName; private final PicoContainer myPicoContainer; - public KeyedExtensionFactory(@NotNull final Class interfaceClass, @NonNls @NotNull final String epName, @NotNull PicoContainer picoContainer) { + public KeyedExtensionFactory(@NotNull final Class interfaceClass, @NonNls @NotNull final ExtensionPointName epName, + @NotNull PicoContainer picoContainer) { myInterfaceClass = interfaceClass; - myEpName = new ExtensionPointName(epName); + myEpName = epName; myPicoContainer = picoContainer; } diff --git a/platform/lang-api/src/com/intellij/openapi/roots/ui/OrderRootTypeUIFactory.java b/platform/lang-api/src/com/intellij/openapi/roots/ui/OrderRootTypeUIFactory.java index 8152efd3984e..ee36676ec5fc 100644 --- a/platform/lang-api/src/com/intellij/openapi/roots/ui/OrderRootTypeUIFactory.java +++ b/platform/lang-api/src/com/intellij/openapi/roots/ui/OrderRootTypeUIFactory.java @@ -21,6 +21,8 @@ package com.intellij.openapi.roots.ui; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.extensions.KeyedFactoryEPBean; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.ui.SdkPathEditor; import com.intellij.openapi.roots.OrderRootType; @@ -30,7 +32,8 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; public interface OrderRootTypeUIFactory { - KeyedExtensionFactory FACTORY = new KeyedExtensionFactory(OrderRootTypeUIFactory.class, "com.intellij.OrderRootTypeUI", + ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.OrderRootTypeUI"); + KeyedExtensionFactory FACTORY = new KeyedExtensionFactory(OrderRootTypeUIFactory.class, EP_NAME, ApplicationManager .getApplication().getPicoContainer()) { @Override diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java index dd6e97a9be54..87ba9c5e7b4d 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java +++ b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java @@ -15,6 +15,8 @@ */ package com.intellij.ide.structureView; +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.extensions.KeyedFactoryEPBean; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileTypes.FileTypeExtensionFactory; import com.intellij.openapi.project.Project; @@ -32,8 +34,10 @@ import org.jetbrains.annotations.NotNull; */ public interface StructureViewBuilder { + ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.structureViewBuilder"); + StructureViewBuilderProvider PROVIDER = - new FileTypeExtensionFactory(StructureViewBuilderProvider.class, "com.intellij.structureViewBuilder").get(); + new FileTypeExtensionFactory(StructureViewBuilderProvider.class, EP_NAME).get(); /** * Returns the structure view implementation for the file displayed in the specified From a9fb95aef301291f2132fab2ae2e41f6e66ae940 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 29 Oct 2013 22:32:40 +0400 Subject: [PATCH 43/43] NPE fix --- .../ide/actions/ShowSettingsUtilImpl.java | 15 ++++++++------- .../options/ex/ProjectConfigurablesGroup.java | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java index fabd1a3eb99f..06317a6952b7 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java @@ -80,7 +80,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil { Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject(); Configurable config = findByClass(new IdeConfigurablesGroup().getConfigurables(), configurableClass); - if (config == null) { + if (config == null && project != null) { config = findByClass(new ProjectConfigurablesGroup(project).getConfigurables(), configurableClass); } @@ -103,23 +103,24 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil { public void showSettingsDialog(@Nullable final Project project, @NotNull final String nameToSelect) { ConfigurableGroup[] group; if (project == null) { - group = new ConfigurableGroup[] {new IdeConfigurablesGroup()}; - } else { - group = new ConfigurableGroup[] {new ProjectConfigurablesGroup(project), new IdeConfigurablesGroup()}; + group = new ConfigurableGroup[]{new IdeConfigurablesGroup()}; + } + else { + group = new ConfigurableGroup[]{new ProjectConfigurablesGroup(project), new IdeConfigurablesGroup()}; } - Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject(); + Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject(); group = filterEmptyGroups(group); OptionsEditorDialog dialog; if (Registry.is("ide.perProjectModality")) { dialog = new OptionsEditorDialog(actualProject, group, nameToSelect, true); - } else { + } + else { dialog = new OptionsEditorDialog(actualProject, group, nameToSelect); } dialog.show(); - } public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java index 563b5471cc29..0109161e7d85 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java @@ -19,6 +19,7 @@ import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurableGroup; import com.intellij.openapi.options.OptionsBundle; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; /** * @author max @@ -26,7 +27,7 @@ import com.intellij.openapi.project.Project; public class ProjectConfigurablesGroup extends ConfigurablesGroupBase implements ConfigurableGroup { private final Project myProject; - public ProjectConfigurablesGroup(Project project) { + public ProjectConfigurablesGroup(@NotNull Project project) { super(project, Configurable.PROJECT_CONFIGURABLE, true); myProject = project; }