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) { 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; } 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) { 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..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); @@ -122,7 +123,7 @@ public class LazyRangeMarkerFactory extends AbstractProjectComponent { } @Nullable - private RangeMarker getOrCreateDelegate() { + protected final RangeMarker getOrCreateDelegate() { if (myDelegate == null) { Document document = FileDocumentManager.getInstance().getDocument(myFile); if (document == null) { @@ -218,6 +219,18 @@ public class LazyRangeMarkerFactory extends AbstractProjectComponent { 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) { 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 ){ 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/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(); 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; 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); 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 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/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(); 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); 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 @@ +