Skip to content
This repository was archived by the owner on Feb 22, 2025. It is now read-only.

Commit f3dc986

Browse files
committed
BackCompatibleUtils: get rid of old reflection code
Focusing of the hyperlink works without this code in modern IDEs.
1 parent 1ece87c commit f3dc986

File tree

2 files changed

+0
-54
lines changed

2 files changed

+0
-54
lines changed

plugin/src/com/microsoft/alm/plugin/idea/common/ui/controls/Hyperlink.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33

44
package com.microsoft.alm.plugin.idea.common.ui.controls;
55

6-
import com.intellij.ui.JBColor;
76
import com.intellij.ui.components.labels.LinkLabel;
87
import com.intellij.ui.components.labels.LinkListener;
9-
import com.microsoft.alm.plugin.idea.common.utils.BackCompatibleUtils;
108

11-
import java.awt.Graphics;
129
import java.awt.event.ActionEvent;
1310
import java.awt.event.ActionListener;
14-
import java.awt.event.FocusEvent;
1511
import java.awt.event.KeyEvent;
1612
import java.util.ArrayList;
1713
import java.util.List;
@@ -60,27 +56,6 @@ protected void processComponentKeyEvent(final KeyEvent e) {
6056
}
6157
}
6258

63-
/**
64-
* We are overriding this method to force a repaint of the control when the focus changes.
65-
*/
66-
@Override
67-
protected void processFocusEvent(final FocusEvent e) {
68-
super.processFocusEvent(e);
69-
super.repaint();
70-
}
71-
72-
/**
73-
* We are overriding this method to paint a focus rectangle around the control.
74-
*/
75-
@Override
76-
protected void paintComponent(final Graphics g) {
77-
super.paintComponent(g);
78-
if (hasFocus()) {
79-
g.setColor(JBColor.black);
80-
BackCompatibleUtils.paintFocusRing(g, 0, 0, getWidth(), getHeight());
81-
}
82-
}
83-
8459
private void notifyActionListeners() {
8560
if (listeners == null || listeners.size() == 0 || !super.isEnabled()) {
8661
return;

plugin/src/com/microsoft/alm/plugin/idea/common/utils/BackCompatibleUtils.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
package com.microsoft.alm.plugin.idea.common.utils;
55

6-
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
76
import com.intellij.util.net.HttpConfigurable;
87
import org.apache.commons.lang.StringUtils;
98
import org.slf4j.Logger;
109
import org.slf4j.LoggerFactory;
1110

12-
import java.awt.Graphics;
13-
import java.awt.Rectangle;
1411
import java.lang.reflect.Field;
1512
import java.lang.reflect.Method;
1613

@@ -45,30 +42,4 @@ public static String getProxyLogin() {
4542
}
4643
}
4744
}
48-
49-
/**
50-
* Executing the DarculaUIUtil.paintFocusRing() method independent of the IDEA version we are on
51-
*
52-
* @param g
53-
* @param x
54-
* @param y
55-
* @param width
56-
* @param height
57-
*/
58-
public static void paintFocusRing(final Graphics g, final int x, final int y, final int width, final int height) {
59-
try {
60-
// trying to paint focus using the IDEA 2017 method
61-
final Method paintFocusRingMethodNew = DarculaUIUtil.class.getDeclaredMethod("paintFocusRing", Graphics.class, Rectangle.class);
62-
paintFocusRingMethodNew.invoke(null, g, new Rectangle(x, y, width, height));
63-
} catch (Exception newImplementationException) {
64-
try {
65-
logger.warn("Failed to get DarculaUIUtil.paintFocusRing() new implementation so attempting old way", newImplementationException);
66-
final Method paintFocusRingMethodOld = DarculaUIUtil.class.getDeclaredMethod("paintFocusRing", Graphics.class,
67-
Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE);
68-
paintFocusRingMethodOld.invoke(null, g, x, y, width, height);
69-
} catch (Exception oldImplementationException) {
70-
logger.warn("Failed to find DarculaUIUtil.paintFocusRing() method", oldImplementationException);
71-
}
72-
}
73-
}
7445
}

0 commit comments

Comments
 (0)