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;
import javax.swing.*;
import java.awt.*;
+import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.Collection;
}
@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;
}
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;
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);
+ }
+ }
}