From 52ec1480073098000060981f684f75adb52d05ef Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 27 Feb 2014 10:42:34 +0100 Subject: [PATCH 01/14] platform: mute system notifications in tests and headless mode --- .../src/com/intellij/ui/SystemNotifications.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/SystemNotifications.java b/platform/platform-impl/src/com/intellij/ui/SystemNotifications.java index 08e38637801d..b0d7b371a3e0 100644 --- a/platform/platform-impl/src/com/intellij/ui/SystemNotifications.java +++ b/platform/platform-impl/src/com/intellij/ui/SystemNotifications.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ */ package com.intellij.ui; +import com.intellij.openapi.application.Application; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; import org.jetbrains.annotations.NotNull; @@ -22,8 +24,14 @@ import org.jetbrains.annotations.NotNull; * @author mike */ public abstract class SystemNotifications { + private static final SystemNotifications NULL = new SystemNotifications() { + @Override + public void notify(@NotNull String notificationName, @NotNull String title, @NotNull String text) { } + }; + public static SystemNotifications getInstance() { - return ServiceManager.getService(SystemNotifications.class); + Application app = ApplicationManager.getApplication(); + return app.isHeadlessEnvironment() || app.isUnitTestMode() ? NULL : ServiceManager.getService(SystemNotifications.class); } public abstract void notify(@NotNull String notificationName, @NotNull String title, @NotNull String text); From 7e47f0e2b62a3eae1df64a831a5d608f8873c9c4 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Thu, 27 Feb 2014 11:10:46 +0100 Subject: [PATCH 02/14] UsefulTestCase.assertExists/assertDoesntExist for io.File --- .../src/com/intellij/testFramework/UsefulTestCase.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index 785c587f488f..104c55e0c77b 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -639,6 +639,14 @@ public abstract class UsefulTestCase extends TestCase { String actualText = StringUtil.convertLineSeparators(actual.trim()); Assert.assertEquals(expectedText, actualText); } + + public static void assertExists(File file){ + assertTrue("File should exists " + file, file.exists()); + } + + public static void assertDoesntExist(File file){ + assertFalse("File should not exists " + file, file.exists()); + } protected String getTestName(boolean lowercaseFirstLetter) { String name = getName(); From 104549e7fcad23ed46242729b830bbf7f10fd4fe Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Thu, 27 Feb 2014 14:36:35 +0400 Subject: [PATCH 03/14] update action presentations even if there are no mouse or key events --- .../intellij/webcore/packaging/InstalledPackagesPanel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java b/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java index f394c836475d..6dd7aebfe2d5 100644 --- a/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java +++ b/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java @@ -2,6 +2,7 @@ package com.intellij.webcore.packaging; import com.google.common.collect.Lists; import com.intellij.icons.AllIcons; +import com.intellij.ide.ActivityTracker; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; @@ -397,6 +398,9 @@ public class InstalledPackagesPanel extends JPanel { myPackagesTable.setPaintBusy(false); myPackagesTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); updateUninstallUpgrade(); + // Action button presentations won't be updated if no events occur (e.g. mouse isn't moving, keys aren't being pressed). + // In that case emulating activity will help: + ActivityTracker.getInstance().inc(); } public void doUpdatePackages(@NotNull final PackageManagementService packageManagementService) { From 7cb4315aedca0c025cf3e39d0b43823c244a8d55 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 10:57:10 +0100 Subject: [PATCH 04/14] cleanup --- .../impl/breakpoints/BreakpointsFavoriteListProvider.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java index 03adc64be2ad..a2a76c84bc18 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java @@ -52,7 +52,6 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid private final List myBreakpointPanelProviders; private final BreakpointItemsTreeController myTreeController; private final List myRulesAvailable = new ArrayList(); - private final BreakpointsSimpleTree myTree; private Set myRulesEnabled = new TreeSet(new Comparator() { @Override @@ -66,8 +65,7 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid super(project, "Breakpoints"); myBreakpointPanelProviders = XBreakpointUtil.collectPanelProviders(); myTreeController = new BreakpointItemsTreeController(myRulesAvailable); - myTree = new BreakpointsSimpleTree(myProject, myTreeController); - myTreeController.setTreeView(myTree); + myTreeController.setTreeView(new BreakpointsSimpleTree(myProject, myTreeController)); updateChildren(); for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) { provider.addListener(this, myProject, myProject); From b51fb7bf126a8c95ebf2223fb51c4b1d3faaa558 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 11:17:44 +0100 Subject: [PATCH 05/14] LazyRangeMarkerFactory as project service +review --- .../openapi/editor/LazyRangeMarkerFactory.java | 13 +++++++------ .../src/META-INF/PlatformLangPlugin.xml | 1 + .../src/META-INF/PlatformPlugin.xml | 1 + .../platform-resources/src/componentSets/Editor.xml | 4 ---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java index 0c468aa373eb..08d82bfd9540 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java @@ -17,7 +17,7 @@ package com.intellij.openapi.editor; import com.intellij.codeStyle.CodeStyleFacade; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.AbstractProjectComponent; +import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -36,11 +36,13 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentMap; -public class LazyRangeMarkerFactory extends AbstractProjectComponent { +public class LazyRangeMarkerFactory { + private final Project myProject; private final ConcurrentMap> myMarkers = new ConcurrentWeakHashMap>(); public LazyRangeMarkerFactory(@NotNull Project project, @NotNull final FileDocumentManager fileDocumentManager) { - super(project); + myProject = project; + EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() { @Override public void beforeDocumentChange(DocumentEvent e) { @@ -71,7 +73,7 @@ public class LazyRangeMarkerFactory extends AbstractProjectComponent { } public static LazyRangeMarkerFactory getInstance(Project project) { - return project.getComponent(LazyRangeMarkerFactory.class); + return ServiceManager.getService(project, LazyRangeMarkerFactory.class); } @NotNull @@ -92,8 +94,7 @@ public class LazyRangeMarkerFactory extends AbstractProjectComponent { return ApplicationManager.getApplication().runReadAction(new Computable() { @Override public RangeMarker compute() { - FileDocumentManager fdm = FileDocumentManager.getInstance(); - final Document document = fdm.getCachedDocument(file); + final Document document = FileDocumentManager.getInstance().getCachedDocument(file); if (document != null) { final int offset = calculateOffset(myProject, file, document, line, column); return document.createRangeMarker(offset, offset, persistent); diff --git a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml index 943f3f568d68..54a54fc51865 100644 --- a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml @@ -21,6 +21,7 @@ + diff --git a/platform/platform-resources/src/META-INF/PlatformPlugin.xml b/platform/platform-resources/src/META-INF/PlatformPlugin.xml index 8cca39a37a4f..72d1efc98464 100644 --- a/platform/platform-resources/src/META-INF/PlatformPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformPlugin.xml @@ -17,6 +17,7 @@ + diff --git a/platform/platform-resources/src/componentSets/Editor.xml b/platform/platform-resources/src/componentSets/Editor.xml index adf1f3bf5d7f..25719abb23f3 100644 --- a/platform/platform-resources/src/componentSets/Editor.xml +++ b/platform/platform-resources/src/componentSets/Editor.xml @@ -30,9 +30,5 @@ com.intellij.openapi.fileEditor.ex.IdeDocumentHistory com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl - - com.intellij.openapi.editor.LazyRangeMarkerFactory - - \ No newline at end of file From d0ade84363a2967bda1efa553a70c3c9c0932590 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 11:33:21 +0100 Subject: [PATCH 06/14] LineColumnLazyMarker must compute delegate on start/end offset request +review --- .../openapi/editor/LazyRangeMarkerFactory.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java index 08d82bfd9540..f296c643d5bb 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java @@ -123,7 +123,7 @@ public class LazyRangeMarkerFactory { } @Nullable - private RangeMarker getOrCreateDelegate() { + protected final RangeMarker getOrCreateDelegate() { if (myDelegate == null) { Document document = FileDocumentManager.getInstance().getDocument(myFile); if (document == null) { @@ -219,6 +219,18 @@ public class LazyRangeMarkerFactory { return document.createRangeMarker(offset, offset); } + + @Override + public int getStartOffset() { + getOrCreateDelegate(); + return super.getStartOffset(); + } + + @Override + public int getEndOffset() { + getOrCreateDelegate(); + return super.getEndOffset(); + } } private static int calculateOffset(@NotNull Project project, @NotNull VirtualFile file, @NotNull Document document, final int line, final int column) { From e2b15889418f18adaa83930fa2f264a12bcf2bbf Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 11:41:22 +0100 Subject: [PATCH 07/14] ability to create OpenFileDescriptor using RangeMarker +review --- .../fileEditor/OpenFileDescriptor.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java index 9561581bc38b..c9e3a0f2145a 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java +++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java @@ -55,31 +55,38 @@ public class OpenFileDescriptor implements Navigatable { private boolean myUseCurrentWindow = false; public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, int offset) { - this(project, file, -1, -1, offset, false); + this(project, file, -1, -1, offset, null, false); } public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, int logicalLine, int logicalColumn) { - this(project, file, logicalLine, logicalColumn, -1, false); + this(project, file, logicalLine, logicalColumn, -1, null, false); } public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, int logicalLine, int logicalColumn, boolean persistent) { - this(project, file, logicalLine, logicalColumn, -1, persistent); + this(project, file, logicalLine, logicalColumn, -1, null, persistent); } public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file) { - this(project, file, -1, -1, -1, false); + this(project, file, -1, -1, -1, null, false); + } + + public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, @NotNull RangeMarker rangeMarker) { + this(project, file, -1, -1, -1, rangeMarker, false); } private OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, - int logicalLine, int logicalColumn, int offset, boolean persistent) { + int logicalLine, int logicalColumn, int offset, @Nullable RangeMarker rangeMarker, boolean persistent) { myProject = project; myFile = file; myLogicalLine = logicalLine; myLogicalColumn = logicalColumn; myOffset = offset; - if (offset >= 0) { + if (rangeMarker != null) { + myRangeMarker = rangeMarker; + } + else if (offset >= 0) { myRangeMarker = LazyRangeMarkerFactory.getInstance(project).createRangeMarker(file, offset); } else if (logicalLine >= 0 ){ From 50ad4732eee74084550a011c900abc8565c38081 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 12:13:35 +0100 Subject: [PATCH 08/14] Revert: LazyRangeMarkerFactory as project service (b51fb7bf126a8c95ebf2223fb51c4b1d3faaa558) --- .../openapi/editor/LazyRangeMarkerFactory.java | 13 ++++++------- .../src/META-INF/PlatformLangPlugin.xml | 1 - .../src/META-INF/PlatformPlugin.xml | 1 - .../platform-resources/src/componentSets/Editor.xml | 4 ++++ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java index f296c643d5bb..ae285a4a2401 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java @@ -17,7 +17,7 @@ package com.intellij.openapi.editor; import com.intellij.codeStyle.CodeStyleFacade; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.AbstractProjectComponent; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -36,13 +36,11 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentMap; -public class LazyRangeMarkerFactory { - private final Project myProject; +public class LazyRangeMarkerFactory extends AbstractProjectComponent { private final ConcurrentMap> myMarkers = new ConcurrentWeakHashMap>(); public LazyRangeMarkerFactory(@NotNull Project project, @NotNull final FileDocumentManager fileDocumentManager) { - myProject = project; - + super(project); EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() { @Override public void beforeDocumentChange(DocumentEvent e) { @@ -73,7 +71,7 @@ public class LazyRangeMarkerFactory { } public static LazyRangeMarkerFactory getInstance(Project project) { - return ServiceManager.getService(project, LazyRangeMarkerFactory.class); + return project.getComponent(LazyRangeMarkerFactory.class); } @NotNull @@ -94,7 +92,8 @@ public class LazyRangeMarkerFactory { return ApplicationManager.getApplication().runReadAction(new Computable() { @Override public RangeMarker compute() { - final Document document = FileDocumentManager.getInstance().getCachedDocument(file); + FileDocumentManager fdm = FileDocumentManager.getInstance(); + final Document document = fdm.getCachedDocument(file); if (document != null) { final int offset = calculateOffset(myProject, file, document, line, column); return document.createRangeMarker(offset, offset, persistent); diff --git a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml index 54a54fc51865..943f3f568d68 100644 --- a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml @@ -21,7 +21,6 @@ - diff --git a/platform/platform-resources/src/META-INF/PlatformPlugin.xml b/platform/platform-resources/src/META-INF/PlatformPlugin.xml index 72d1efc98464..8cca39a37a4f 100644 --- a/platform/platform-resources/src/META-INF/PlatformPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformPlugin.xml @@ -17,7 +17,6 @@ - diff --git a/platform/platform-resources/src/componentSets/Editor.xml b/platform/platform-resources/src/componentSets/Editor.xml index 25719abb23f3..adf1f3bf5d7f 100644 --- a/platform/platform-resources/src/componentSets/Editor.xml +++ b/platform/platform-resources/src/componentSets/Editor.xml @@ -30,5 +30,9 @@ com.intellij.openapi.fileEditor.ex.IdeDocumentHistory com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl + + com.intellij.openapi.editor.LazyRangeMarkerFactory + + \ No newline at end of file From 6f684e8cbd8e177bc86ae68707be173f2c12195a Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Thu, 27 Feb 2014 15:14:08 +0400 Subject: [PATCH 09/14] IDEA-121338 Multiple Carets: Menu items for multiple cursors are empty --- .../src/messages/ActionsBundle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index 8d51e6b5dbd2..2c4adec5a674 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -107,8 +107,8 @@ action.EditorMoveUpAndScrollWithSelection.text=Move Up and Scroll with Selection action.EditorMoveDownAndScrollWithSelection.text=Move Down and Scroll with Selection action.EditorCloneCaretBelow.text=Clone Caret Below action.EditorCloneCaretAbove.text=Clone Caret Above -action.SelectNextOccurence.text=Select Next Occurence -action.UnselectLastOccurence.text=Unselect Last Occurence +action.SelectNextOccurrence.text=Select Next Occurrence +action.UnselectLastOccurrence.text=Unselect Last Occurrence action.EditorToggleStickySelection.text=Toggle Sticky Selection action.EditorSwapSelectionBoundaries.text=Swap selection boundaries action.EditorLineStart.text=Move Caret to Line Start From 1f9c6dad7fd976334c99bcca7fda9aa5d8995472 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 27 Feb 2014 12:17:19 +0100 Subject: [PATCH 10/14] EA-51130 (use data class' loader to register data flavor) --- .../src/com/intellij/ide/dnd/FileCopyPasteUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/dnd/FileCopyPasteUtil.java b/platform/platform-impl/src/com/intellij/ide/dnd/FileCopyPasteUtil.java index cecde708b61b..dca050bcd31f 100644 --- a/platform/platform-impl/src/com/intellij/ide/dnd/FileCopyPasteUtil.java +++ b/platform/platform-impl/src/com/intellij/ide/dnd/FileCopyPasteUtil.java @@ -51,8 +51,8 @@ public class FileCopyPasteUtil { public static DataFlavor createDataFlavor(@NotNull final String mimeType, @Nullable final Class klass, final boolean register) { try { - final String typeString = klass != null ? mimeType + ";class=" + klass.getName() : mimeType; - final DataFlavor flavor = new DataFlavor(typeString); + final DataFlavor flavor = + klass != null ? new DataFlavor(mimeType + ";class=" + klass.getName(), null, klass.getClassLoader()) : new DataFlavor(mimeType); if (register) { final FlavorMap map = SystemFlavorMap.getDefaultFlavorMap(); From a4fef1b65c0baa537608900138805435a04c4340 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 12:21:44 +0100 Subject: [PATCH 11/14] =?UTF-8?q?LazyRangeMarkerFactory=20as=20project=20s?= =?UTF-8?q?ervice=20=E2=80=94=20reapplied,=20add=20missed=20to=20RichPlatf?= =?UTF-8?q?ormPlugin.xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openapi/editor/LazyRangeMarkerFactory.java | 13 +++++++------ .../src/META-INF/EditorExtensions.xml | 5 +++++ .../src/META-INF/PlatformLangPlugin.xml | 1 + .../src/META-INF/PlatformPlugin.xml | 1 + .../platform-resources/src/componentSets/Editor.xml | 4 ---- resources/src/idea/RichPlatformPlugin.xml | 1 + 6 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 platform/platform-resources/src/META-INF/EditorExtensions.xml diff --git a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java index ae285a4a2401..f296c643d5bb 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/LazyRangeMarkerFactory.java @@ -17,7 +17,7 @@ package com.intellij.openapi.editor; import com.intellij.codeStyle.CodeStyleFacade; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.AbstractProjectComponent; +import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -36,11 +36,13 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentMap; -public class LazyRangeMarkerFactory extends AbstractProjectComponent { +public class LazyRangeMarkerFactory { + private final Project myProject; private final ConcurrentMap> myMarkers = new ConcurrentWeakHashMap>(); public LazyRangeMarkerFactory(@NotNull Project project, @NotNull final FileDocumentManager fileDocumentManager) { - super(project); + myProject = project; + EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() { @Override public void beforeDocumentChange(DocumentEvent e) { @@ -71,7 +73,7 @@ public class LazyRangeMarkerFactory extends AbstractProjectComponent { } public static LazyRangeMarkerFactory getInstance(Project project) { - return project.getComponent(LazyRangeMarkerFactory.class); + return ServiceManager.getService(project, LazyRangeMarkerFactory.class); } @NotNull @@ -92,8 +94,7 @@ public class LazyRangeMarkerFactory extends AbstractProjectComponent { return ApplicationManager.getApplication().runReadAction(new Computable() { @Override public RangeMarker compute() { - FileDocumentManager fdm = FileDocumentManager.getInstance(); - final Document document = fdm.getCachedDocument(file); + final Document document = FileDocumentManager.getInstance().getCachedDocument(file); if (document != null) { final int offset = calculateOffset(myProject, file, document, line, column); return document.createRangeMarker(offset, offset, persistent); diff --git a/platform/platform-resources/src/META-INF/EditorExtensions.xml b/platform/platform-resources/src/META-INF/EditorExtensions.xml new file mode 100644 index 000000000000..f2e50a2fde46 --- /dev/null +++ b/platform/platform-resources/src/META-INF/EditorExtensions.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml index 943f3f568d68..54a54fc51865 100644 --- a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml @@ -21,6 +21,7 @@ + diff --git a/platform/platform-resources/src/META-INF/PlatformPlugin.xml b/platform/platform-resources/src/META-INF/PlatformPlugin.xml index 8cca39a37a4f..72d1efc98464 100644 --- a/platform/platform-resources/src/META-INF/PlatformPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformPlugin.xml @@ -17,6 +17,7 @@ + diff --git a/platform/platform-resources/src/componentSets/Editor.xml b/platform/platform-resources/src/componentSets/Editor.xml index adf1f3bf5d7f..25719abb23f3 100644 --- a/platform/platform-resources/src/componentSets/Editor.xml +++ b/platform/platform-resources/src/componentSets/Editor.xml @@ -30,9 +30,5 @@ com.intellij.openapi.fileEditor.ex.IdeDocumentHistory com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl - - com.intellij.openapi.editor.LazyRangeMarkerFactory - - \ No newline at end of file diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index e6ab127a6b67..cd22c2f41ea3 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -108,6 +108,7 @@ + From ad552edb7d3841142f750e9205be6f877afbe1bf Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Feb 2014 12:33:38 +0100 Subject: [PATCH 12/14] CR-IC-4539 --- .../src/com/intellij/openapi/editor/impl/MarkupModelImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java index 50a9922d1bcb..161254604022 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java @@ -82,7 +82,7 @@ public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx } int offset = getFirstNonSpaceCharOffset(getDocument(), lineNumber); - return addRangeHighlighter(PersistentRangeHighlighterImpl.create(this, offset, layer, HighlighterTargetArea.LINES_IN_RANGE, null, false), null); + return addRangeHighlighter(PersistentRangeHighlighterImpl.create(this, offset, layer, HighlighterTargetArea.LINES_IN_RANGE, textAttributes, false), null); } private boolean isNotValidLine(int lineNumber) { From 7eebbf441e38538086b1ecfa266f7c1554b7518f Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Thu, 27 Feb 2014 15:49:14 +0400 Subject: [PATCH 13/14] Fix for IDEA-121307 Cannot create new file (StubVirtualFile throws an exception on isDirectory) --- .../file/exclude/EnforcedPlainTextFileTypeManager.java | 5 +++-- .../openapi/file/exclude/PersistentFileSetManager.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java index 420ed2931d64..830681b9ba5e 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java @@ -28,6 +28,7 @@ import com.intellij.openapi.roots.ex.ProjectRootManagerEx; import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.newvfs.impl.StubVirtualFile; import com.intellij.util.containers.ConcurrentHashMap; import com.intellij.util.indexing.FileBasedIndex; import org.jetbrains.annotations.NotNull; @@ -51,7 +52,7 @@ public class EnforcedPlainTextFileTypeManager implements ProjectManagerListener } public boolean isMarkedAsPlainText(VirtualFile file) { - if (file.isDirectory()) return false; + if (file instanceof StubVirtualFile || file.isDirectory()) return false; synchronized (mySetsInitialized) { if (!mySetsInitialized.get()) { initPlainTextFileSets(); @@ -73,7 +74,7 @@ public class EnforcedPlainTextFileTypeManager implements ProjectManagerListener } public static boolean isApplicableFor(@NotNull VirtualFile file) { - if (file.isDirectory()) return false; + if (file instanceof StubVirtualFile || file.isDirectory()) return false; FileType originalType = FileTypeManager.getInstance().getFileTypeByFileName(file.getName()); return !originalType.isBinary() && originalType != FileTypes.PLAIN_TEXT && originalType != StdFileTypes.JAVA; } diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/PersistentFileSetManager.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/PersistentFileSetManager.java index aab5c78defb8..6cf91fe5a0c0 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/PersistentFileSetManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/PersistentFileSetManager.java @@ -19,6 +19,7 @@ import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.openapi.vfs.newvfs.impl.StubVirtualFile; import com.intellij.util.containers.HashSet; import org.jdom.Attribute; import org.jdom.Element; @@ -36,7 +37,7 @@ public class PersistentFileSetManager implements PersistentStateComponent myFiles = new HashSet(); protected boolean addFile(VirtualFile file) { - if (file.isDirectory()) return false; + if (file instanceof StubVirtualFile || file.isDirectory()) return false; myFiles.add(file); return true; } From 08190b2389068cb26235771cfa3fca14d117f826 Mon Sep 17 00:00:00 2001 From: Vassiliy Date: Thu, 27 Feb 2014 16:04:12 +0400 Subject: [PATCH 14/14] IDEA-116029 in-place introduce variable name suggestions popup disappears before I can select anything --- .../src/com/intellij/codeInsight/hint/HintManagerImpl.java | 1 + .../src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java index caecb4c31d7d..e79890eaaecd 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java @@ -131,6 +131,7 @@ public class HintManagerImpl extends HintManager implements Disposable { myEditorFocusListener = new FocusAdapter() { @Override public void focusLost(final FocusEvent e) { + if (UIUtil.isFocusProxy(e.getOppositeComponent())) return; myHideAlarm.addRequest(new Runnable() { @Override public void run() { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java index 09de7d3ddcfb..7719e784a4ee 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java @@ -52,7 +52,12 @@ public class IdeGlassPaneImpl extends JPanel implements IdeGlassPaneEx, IdeEvent private Cursor myLastOriginalCursor; private MouseEvent myPrevPressEvent; - private JPanel myFocusProxy = new JPanel(); + private JPanel myFocusProxy = new JPanel(){ + @Override + public String toString() { + return "FocusProxy"; + } + }; public IdeGlassPaneImpl(JRootPane rootPane) { myRootPane = rootPane;