Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2016-03-06 21:34:14 +01:00
3 changed files with 29 additions and 1 deletions
@@ -93,6 +93,7 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
@NotNull private final TableCellRenderer myDummyRenderer = new DefaultTableCellRenderer();
@NotNull private final GraphCommitCellRender myGraphCommitCellRenderer;
private boolean myColumnsSizeInitialized = false;
@Nullable private Selection mySelection = null;
@NotNull private final Collection<VcsLogHighlighter> myHighlighters = ContainerUtil.newArrayList();
@@ -121,6 +122,8 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
addMouseMotionListener(mouseAdapter);
addMouseListener(mouseAdapter);
getSelectionModel().addListSelectionListener(new MyListSelectionListener());
PopupHandler.installPopupHandler(this, VcsLogActionPlaces.POPUP_ACTION_GROUP, VcsLogActionPlaces.VCS_LOG_TABLE_PLACE);
ScrollingUtil.installActions(this, false);
@@ -463,7 +466,8 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
@NotNull
public Selection getSelection() {
return new Selection(this);
if (mySelection == null) mySelection = new Selection(this);
return mySelection;
}
private static class Selection {
@@ -917,4 +921,11 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
mouseInputListener.mouseMoved(convertMouseEvent(e));
}
}
private class MyListSelectionListener implements ListSelectionListener {
@Override
public void valueChanged(ListSelectionEvent e) {
mySelection = null;
}
}
}
@@ -99,6 +99,17 @@ public class UnnecessaryBoxingInspection extends BaseInspection {
return;
}
final PsiExpression unboxedExpression = arguments[0];
final Object value = ExpressionUtils.computeConstantExpression(unboxedExpression);
if (value != null) {
if (value == Boolean.TRUE) {
PsiReplacementUtil.replaceExpression(expression, "java.lang.Boolean.TRUE");
return;
}
else if (value == Boolean.FALSE) {
PsiReplacementUtil.replaceExpression(expression, "java.lang.Boolean.FALSE");
return;
}
}
final String replacementText = getUnboxedExpressionText(unboxedExpression, boxedType);
if (replacementText == null) {
return;
@@ -56,6 +56,12 @@ public class UnnecessaryBoxingFixTest extends IGQuickFixesTestCase {
"Double l = 1d;");
}
public void testBooleanLiteral() {
doMemberTest(InspectionGadgetsBundle.message("unnecessary.boxing.remove.quickfix"),
"final Boolean aBoolean = Boolean.valueOf(/**/true);",
"final Boolean aBoolean = Boolean.TRUE;");
}
public void testCast() {
doFixTest();
}