Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ekaterina Tuzova
2014-02-27 16:13:26 +04:00
18 changed files with 81 additions and 31 deletions
@@ -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) {
@@ -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;
}
@@ -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<Elemen
private final Set<VirtualFile> myFiles = new HashSet<VirtualFile>();
protected boolean addFile(VirtualFile file) {
if (file.isDirectory()) return false;
if (file instanceof StubVirtualFile || file.isDirectory()) return false;
myFiles.add(file);
return true;
}
@@ -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) {
@@ -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<VirtualFile,WeakList<LazyMarker>> myMarkers = new ConcurrentWeakHashMap<VirtualFile, WeakList<LazyMarker>>();
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<RangeMarker>() {
@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) {
@@ -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 ){
@@ -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() {
@@ -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();
@@ -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;
@@ -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);
@@ -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
@@ -0,0 +1,5 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<projectService serviceImplementation="com.intellij.openapi.editor.LazyRangeMarkerFactory"/>
</extensions>
</idea-plugin>
@@ -21,6 +21,7 @@
<xi:include href="/META-INF/PlatformExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/VcsExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/LangExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/EditorExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<applicationService serviceInterface="com.intellij.ide.RecentProjectsManagerBase"
serviceImplementation="com.intellij.ide.RecentDirectoryProjectsManagerEx"/>
@@ -17,6 +17,7 @@
<extensions defaultExtensionNs="com.intellij">
<xi:include href="/META-INF/PlatformExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/VcsExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/EditorExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<applicationService serviceInterface="com.intellij.ide.RecentProjectsManagerBase"
serviceImplementation="com.intellij.ide.RecentDirectoryProjectsManager"/>
@@ -30,9 +30,5 @@
<interface-class>com.intellij.openapi.fileEditor.ex.IdeDocumentHistory</interface-class>
<implementation-class>com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl</implementation-class>
</component>
<component>
<implementation-class>com.intellij.openapi.editor.LazyRangeMarkerFactory</implementation-class>
<loadForDefaultProject/>
</component>
</project-components>
</components>
@@ -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();
@@ -52,7 +52,6 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
private final List<BreakpointPanelProvider> myBreakpointPanelProviders;
private final BreakpointItemsTreeController myTreeController;
private final List<XBreakpointGroupingRule> myRulesAvailable = new ArrayList<XBreakpointGroupingRule>();
private final BreakpointsSimpleTree myTree;
private Set<XBreakpointGroupingRule> myRulesEnabled = new TreeSet<XBreakpointGroupingRule>(new Comparator<XBreakpointGroupingRule>() {
@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);
@@ -108,6 +108,7 @@
<xi:include href="/META-INF/VcsExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/LangExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/ExternalSystemExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/META-INF/EditorExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<projectViewPane implementation="com.intellij.ide.projectView.impl.ProjectViewPane"/>