mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] fix links in table
This commit is contained in:
@@ -230,7 +230,7 @@ public class GraphTableController {
|
||||
}
|
||||
|
||||
private class MyMouseAdapter extends MouseAdapter {
|
||||
@NotNull private final TableLinkMouseListener myLinkListener = new TableLinkMouseListener();
|
||||
@NotNull private final TableLinkMouseListener myLinkListener = myCommitRenderer.createLinkListener();
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
|
||||
+23
-6
@@ -2,6 +2,8 @@ package com.intellij.vcs.log.ui.render;
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vcs.changes.issueLinks.IssueLinkRenderer;
|
||||
import com.intellij.openapi.vcs.changes.issueLinks.TableLinkMouseListener;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.ui.SimpleColoredRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
@@ -20,6 +22,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -46,12 +49,12 @@ public class GraphCommitCellRenderer extends TypeSafeTableCellRenderer<GraphComm
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Component getTableCellRendererComponentImpl(@NotNull JTable table,
|
||||
@NotNull GraphCommitCell value,
|
||||
boolean isSelected,
|
||||
boolean hasFocus,
|
||||
int row,
|
||||
int column) {
|
||||
protected SimpleColoredComponent getTableCellRendererComponentImpl(@NotNull JTable table,
|
||||
@NotNull GraphCommitCell value,
|
||||
boolean isSelected,
|
||||
boolean hasFocus,
|
||||
int row,
|
||||
int column) {
|
||||
myComponent.customize(value, isSelected, hasFocus, row, column);
|
||||
return myComponent;
|
||||
}
|
||||
@@ -104,6 +107,10 @@ public class GraphCommitCellRenderer extends TypeSafeTableCellRenderer<GraphComm
|
||||
return myGraphTable.getColumnModel().getColumn(GraphTableModel.COMMIT_COLUMN).getWidth();
|
||||
}
|
||||
|
||||
public TableLinkMouseListener createLinkListener() {
|
||||
return new MyTableLinkMouseListener();
|
||||
}
|
||||
|
||||
private static class MyComponent extends SimpleColoredRenderer {
|
||||
@NotNull private final VcsLogData myLogData;
|
||||
@NotNull private final VcsLogGraphTable myGraphTable;
|
||||
@@ -252,4 +259,14 @@ public class GraphCommitCellRenderer extends TypeSafeTableCellRenderer<GraphComm
|
||||
return myWidth;
|
||||
}
|
||||
}
|
||||
|
||||
public class MyTableLinkMouseListener extends TableLinkMouseListener {
|
||||
@Override
|
||||
protected Object tryGetTag(@NotNull MouseEvent e, @NotNull JTable table, int row, int column) {
|
||||
SimpleColoredComponent component =
|
||||
getTableCellRendererComponentImpl(table, getValue(table.getValueAt(row, column)), false, false, row, column);
|
||||
Rectangle rc = table.getCellRect(row, column, false);
|
||||
return component.getFragmentTagAt(e.getX() - rc.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user