Merge remote-tracking branch 'origin/master'

This commit is contained in:
Andrey Vlasovskikh
2014-11-10 17:25:40 +03:00
3 changed files with 32 additions and 38 deletions
@@ -264,7 +264,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
@Nullable
@Override
public Caret addCaret(@NotNull VisualPosition pos) {
myEditor.assertIsDispatchThread();
EditorImpl.assertIsDispatchThread();
CaretImpl caret = new CaretImpl(myEditor);
caret.moveToVisualPosition(pos, false);
if (addCaret(caret)) {
@@ -291,7 +291,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
@Override
public boolean removeCaret(@NotNull Caret caret) {
myEditor.assertIsDispatchThread();
EditorImpl.assertIsDispatchThread();
if (myCarets.size() <= 1 || !(caret instanceof CaretImpl)) {
return false;
}
@@ -307,7 +307,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
@Override
public void removeSecondaryCarets() {
myEditor.assertIsDispatchThread();
EditorImpl.assertIsDispatchThread();
if (!supportsMultipleCarets()) {
return;
}
@@ -329,7 +329,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
@Override
public void runForEachCaret(@NotNull final CaretAction action, final boolean reverseOrder) {
myEditor.assertIsDispatchThread();
EditorImpl.assertIsDispatchThread();
if (!supportsMultipleCarets()) {
action.perform(getPrimaryCaret());
return;
@@ -358,7 +358,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
@Override
public void runBatchCaretOperation(@NotNull Runnable runnable) {
myEditor.assertIsDispatchThread();
EditorImpl.assertIsDispatchThread();
doWithCaretMerging(runnable);
}
@@ -442,7 +442,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
@Override
public void setCaretsAndSelections(@NotNull final List<CaretState> caretStates, final boolean updateSystemSelection) {
myEditor.assertIsDispatchThread();
EditorImpl.assertIsDispatchThread();
if (caretStates.isEmpty()) {
throw new IllegalArgumentException("At least one caret should exist");
}
@@ -23,6 +23,7 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import java.awt.*;
@@ -110,7 +111,8 @@ public class TableExpandableItemsHandler extends AbstractExpandableItemsHandler<
public Pair<Component, Rectangle> getCellRendererAndBounds(TableCell key) {
if (key.row < 0 || key.row >= myComponent.getRowCount() ||
key.column < 0 || key.column >= myComponent.getColumnCount() ||
key.row == myComponent.getEditingRow() && key.column == myComponent.getEditingColumn()) {
key.row == myComponent.getEditingRow() && key.column == myComponent.getEditingColumn() ||
hasDraggingOrResizingColumn()) {
return null;
}
@@ -143,4 +145,9 @@ public class TableExpandableItemsHandler extends AbstractExpandableItemsHandler<
return new TableCell(rowIndex, columnIndex);
}
private boolean hasDraggingOrResizingColumn() {
JTableHeader header = myComponent.getTableHeader();
return header != null && (header.getResizingColumn() != null || header.getDraggedColumn() != null);
}
}
@@ -37,7 +37,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.event.HyperlinkEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -83,17 +82,16 @@ public class VcsRootProblemNotifier {
return;
}
Collection<VcsRootError> unregisteredRoots = getUnregisteredRoots(errors);
Collection<VcsRootError> important = getImportantMappings(unregisteredRoots);
Collection<VcsRootError> importantUnregisteredRoots = getImportantUnregisteredMappings(errors);
Collection<VcsRootError> invalidRoots = getInvalidRoots(errors);
if (invalidRoots.isEmpty() && (important.isEmpty() || myReportedUnregisteredRoots.containsAll(important))) {
if (invalidRoots.isEmpty() && (importantUnregisteredRoots.isEmpty() || myReportedUnregisteredRoots.containsAll(importantUnregisteredRoots))) {
return;
}
myReportedUnregisteredRoots.addAll(unregisteredRoots);
myReportedUnregisteredRoots.addAll(importantUnregisteredRoots);
String title = makeTitle(unregisteredRoots, invalidRoots);
String description = makeDescription(unregisteredRoots, invalidRoots);
String title = makeTitle(importantUnregisteredRoots, invalidRoots);
String description = makeDescription(importantUnregisteredRoots, invalidRoots);
synchronized (NOTIFICATION_LOCK) {
expireNotification();
@@ -105,17 +103,6 @@ public class VcsRootProblemNotifier {
}
}
@NotNull
private List<VcsRootError> getImportantMappings(@NotNull Collection<VcsRootError> unregisteredRoots) {
return ContainerUtil.filter(unregisteredRoots, new Condition<VcsRootError>() {
@Override
public boolean value(VcsRootError error) {
String mapping = error.getMapping();
return isUnderProjectDir(mapping) && !isIgnored(mapping);
}
});
}
private boolean isUnderProjectDir(@NotNull String mapping) {
return mapping.equals(VcsDirectoryMapping.PROJECT_CONSTANT) || FileUtil.isAncestor(myProject.getBasePath(), mapping, false);
}
@@ -207,24 +194,24 @@ public class VcsRootProblemNotifier {
}
@NotNull
private static Collection<VcsRootError> getUnregisteredRoots(@NotNull Collection<VcsRootError> errors) {
return filterErrorsByType(errors, VcsRootError.Type.UNREGISTERED_ROOT);
private List<VcsRootError> getImportantUnregisteredMappings(@NotNull Collection<VcsRootError> errors) {
return ContainerUtil.filter(errors, new Condition<VcsRootError>() {
@Override
public boolean value(VcsRootError error) {
String mapping = error.getMapping();
return error.getType() == VcsRootError.Type.UNREGISTERED_ROOT && isUnderProjectDir(mapping) && !isIgnored(mapping);
}
});
}
@NotNull
private static Collection<VcsRootError> getInvalidRoots(@NotNull Collection<VcsRootError> errors) {
return filterErrorsByType(errors, VcsRootError.Type.EXTRA_MAPPING);
}
@NotNull
private static Collection<VcsRootError> filterErrorsByType(@NotNull Collection<VcsRootError> errors, @NotNull VcsRootError.Type type) {
Collection<VcsRootError> roots = new ArrayList<VcsRootError>();
for (VcsRootError error : errors) {
if (error.getType() == type) {
roots.add(error);
return ContainerUtil.filter(errors, new Condition<VcsRootError>() {
@Override
public boolean value(VcsRootError error) {
return error.getType() == VcsRootError.Type.EXTRA_MAPPING;
}
}
return roots;
});
}
private static class MyNotificationListener implements NotificationListener {