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 @@ + 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 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); } } } 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/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(); 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/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/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 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-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/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); } 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); } }; 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..2c01b0480bad 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; @@ -372,30 +375,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) { @@ -403,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); } } @@ -592,7 +576,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()); } @@ -605,18 +593,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 { @@ -1462,15 +1471,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; @@ -1497,7 +1506,36 @@ 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); + 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) { diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java index b0281439cd37..adb11273b870 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java @@ -293,12 +293,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb if (contentEntry == null) { return false; } - final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders(); - for (ExcludeFolder excludeFolder : excludeFolders) { - final VirtualFile excludedDir = excludeFolder.getFile(); - if (excludedDir == null) { - continue; - } + for (VirtualFile excludedDir : contentEntry.getExcludeFolderFiles()) { if (VfsUtilCore.isAncestor(excludedDir, file, true)) { return true; } @@ -312,8 +307,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb if (contentEntry == null) { return null; } - final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders(); - for (final ExcludeFolder excludeFolder : excludeFolders) { + for (final ExcludeFolder excludeFolder : contentEntry.getExcludeFolders()) { final VirtualFile f = excludeFolder.getFile(); if (f == null) { continue; diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryTreeCellRenderer.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryTreeCellRenderer.java index 791347676993..290243b2cc7a 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryTreeCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryTreeCellRenderer.java @@ -21,7 +21,6 @@ import com.intellij.ide.util.treeView.NodeDescriptor; import com.intellij.ide.util.treeView.NodeRenderer; import com.intellij.openapi.fileChooser.FileElement; import com.intellij.openapi.roots.ContentEntry; -import com.intellij.openapi.roots.ExcludeFolder; import com.intellij.openapi.roots.SourceFolder; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -81,9 +80,8 @@ public class ContentEntryTreeCellRenderer extends NodeRenderer { } protected Icon updateIcon(final ContentEntry entry, final VirtualFile file, Icon originalIcon) { - for (ExcludeFolder excludeFolder : entry.getExcludeFolders()) { - final VirtualFile excludePath = excludeFolder.getFile(); - if (excludePath != null && VfsUtilCore.isAncestor(excludePath, file, false)) { + for (VirtualFile excludePath : entry.getExcludeFolderFiles()) { + if (VfsUtilCore.isAncestor(excludePath, file, false)) { return AllIcons.Modules.ExcludeRoot; } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentRootPanel.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentRootPanel.java index 343f1f550be3..561dae206abb 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentRootPanel.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentRootPanel.java @@ -114,8 +114,7 @@ public abstract class ContentRootPanel extends JPanel { folderByType.putValue(folder.getRootType(), folder); } - final ExcludeFolder[] excludeFolders = getContentEntry().getExcludeFolders(); - for (final ExcludeFolder excludeFolder : excludeFolders) { + for (final ExcludeFolder excludeFolder : getContentEntry().getExcludeFolders()) { if (!excludeFolder.isSynthetic()) { excluded.add(excludeFolder); } @@ -272,12 +271,7 @@ public abstract class ContentRootPanel extends JPanel { if (contentEntry == null) { return false; } - final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders(); - for (ExcludeFolder excludeFolder : excludeFolders) { - final VirtualFile excludedDir = excludeFolder.getFile(); - if (excludedDir == null) { - continue; - } + for (VirtualFile excludedDir : contentEntry.getExcludeFolderFiles()) { if (VfsUtilCore.isAncestor(excludedDir, file, true)) { return true; } @@ -291,8 +285,7 @@ public abstract class ContentRootPanel extends JPanel { if (contentEntry == null) { return null; } - final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders(); - for (final ExcludeFolder excludeFolder : excludeFolders) { + for (final ExcludeFolder excludeFolder : contentEntry.getExcludeFolders()) { final VirtualFile f = excludeFolder.getFile(); if (f == null) { continue; 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) { 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..ea9a263d5713 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() { @@ -278,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(); 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 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; } 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(); } diff --git a/platform/projectModel-api/src/com/intellij/openapi/roots/ContentEntry.java b/platform/projectModel-api/src/com/intellij/openapi/roots/ContentEntry.java index 5c5d366f912b..5b607556eb54 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/roots/ContentEntry.java +++ b/platform/projectModel-api/src/com/intellij/openapi/roots/ContentEntry.java @@ -179,5 +179,12 @@ public interface ContentEntry extends Synthetic { */ void removeExcludeFolder(@NotNull ExcludeFolder excludeFolder); + /** + * Removes an exclude root from this content root. + * @param url url of the exclude root + * @return {@code true} if the exclude root was removed + */ + boolean removeExcludeFolder(@NotNull String url); + void clearExcludeFolders(); } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java index b275b43e362c..8e3b9bed8d75 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ContentEntryImpl.java @@ -292,6 +292,18 @@ public class ContentEntryImpl extends RootModelComponentBase implements ContentE Disposer.dispose((Disposable)excludeFolder); } + @Override + public boolean removeExcludeFolder(@NotNull String url) { + for (ExcludeFolder folder : myExcludeFolders) { + if (folder.getUrl().equals(url)) { + myExcludeFolders.remove(folder); + Disposer.dispose((Disposable)folder); + return true; + } + } + return false; + } + @Override public void clearExcludeFolders() { assert !isDisposed(); diff --git a/platform/projectModel-impl/src/com/intellij/project/model/impl/module/content/JpsContentEntry.java b/platform/projectModel-impl/src/com/intellij/project/model/impl/module/content/JpsContentEntry.java index 96d074e0514e..f8d3750a2cb1 100644 --- a/platform/projectModel-impl/src/com/intellij/project/model/impl/module/content/JpsContentEntry.java +++ b/platform/projectModel-impl/src/com/intellij/project/model/impl/module/content/JpsContentEntry.java @@ -255,6 +255,19 @@ public class JpsContentEntry implements ContentEntry, Disposable { Disposer.dispose(folder); } + @Override + public boolean removeExcludeFolder(@NotNull String url) { + for (JpsExcludeFolder folder : myExcludeFolders) { + if (folder.getUrl().equals(url)) { + myExcludeFolders.remove(folder); + myModule.getExcludeRootsList().removeUrl(url); + Disposer.dispose(folder); + return true; + } + } + return false; + } + @Override public void clearExcludeFolders() { List toRemove = new ArrayList(); 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); } 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/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, 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 000000000000..c80e8d1c43b6 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/CollapseBranches.png differ 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 000000000000..4df8d3e58bc8 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/CollapseBranches@2x.png differ diff --git a/platform/vcs-log/impl/resources/icons/CollapseBranches@2x_dark.png b/platform/vcs-log/impl/resources/icons/CollapseBranches@2x_dark.png new file mode 100755 index 000000000000..9466c42c5c5c Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/CollapseBranches@2x_dark.png differ diff --git a/platform/vcs-log/impl/resources/icons/CollapseBranches_dark.png b/platform/vcs-log/impl/resources/icons/CollapseBranches_dark.png new file mode 100755 index 000000000000..d832bc003847 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/CollapseBranches_dark.png differ diff --git a/platform/vcs-log/impl/resources/icons/ExpandBranches.png b/platform/vcs-log/impl/resources/icons/ExpandBranches.png new file mode 100755 index 000000000000..da22cae8252b Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ExpandBranches.png differ 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 000000000000..9273a6908a41 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ExpandBranches@2x.png differ diff --git a/platform/vcs-log/impl/resources/icons/ExpandBranches@2x_dark.png b/platform/vcs-log/impl/resources/icons/ExpandBranches@2x_dark.png new file mode 100755 index 000000000000..6a9c3a4e07e7 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ExpandBranches@2x_dark.png differ 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 000000000000..b188f9b4d9ce Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ExpandBranches_dark.png differ diff --git a/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png new file mode 100755 index 000000000000..9dca4ea7001c Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png differ diff --git a/platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x.png b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x.png new file mode 100755 index 000000000000..c47ccbddfef4 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x.png differ 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 000000000000..abf92c8943e1 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges@2x_dark.png differ 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 000000000000..0b1256fb16d8 Binary files /dev/null and b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges_dark.png differ 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/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; } }); 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..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 @@ -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; @@ -35,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); @@ -48,11 +49,16 @@ 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). - AbstractVcsLogTableModel model; + final AbstractVcsLogTableModel model; if (!detailsFilters.isEmpty()) { List filteredCommits = filterByDetails(graphModel, detailsFilters); model = new NoGraphTableModel(myUI, filteredCommits, myLogDataHolder.getDataPack().getRefsModel(), true); @@ -61,12 +67,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) { @@ -80,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/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() + ")"; + } + } 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/VcsLogUI.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUI.java index 05de16622caa..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 @@ -1,9 +1,8 @@ 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; import com.intellij.vcs.log.Hash; import com.intellij.vcs.log.VcsLogFilter; @@ -19,11 +18,13 @@ 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; import javax.swing.table.TableModel; import java.util.Collection; +import java.util.concurrent.CountDownLatch; /** * @author erokhins @@ -68,7 +69,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 +94,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); @@ -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) { @@ -145,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) { @@ -176,10 +193,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 +231,11 @@ public class VcsLogUI { } public void applyFiltersAndUpdateUi() { - myFilterer.applyFiltersAndUpdateUi(collectFilters()); + runUnderModalProgress("Applying filters...", new Runnable() { + public void run() { + myFilterer.applyFiltersAndUpdateUi(collectFilters()); + } + }); } @NotNull @@ -209,7 +243,7 @@ public class VcsLogUI { return myMainFrame.getFilterUi().getFilters(); } - public JBTable getTable() { + public VcsLogGraphTable getTable() { return myMainFrame.getGraphTable(); } @@ -222,4 +256,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(); } } } 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/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()) { 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; } } 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 @@ + 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(); 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"/> + + 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/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; } 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; } 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 - + @@ -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/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/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/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(); } 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) { 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); 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/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); } } 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 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 _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());