Lines 96-101
Link Here
|
96 |
|
96 |
|
97 |
private boolean hyperlinkEnabled; |
97 |
private boolean hyperlinkEnabled; |
98 |
private int actionKeyMask; |
98 |
private int actionKeyMask; |
|
|
99 |
private int altActionKeyMask; |
99 |
|
100 |
|
100 |
public static void ensureRegistered(JTextComponent component, String mimeType) { |
101 |
public static void ensureRegistered(JTextComponent component, String mimeType) { |
101 |
if (component.getClientProperty(KEY) == null) { |
102 |
if (component.getClientProperty(KEY) == null) { |
Lines 106-111
Link Here
|
106 |
private static synchronized Cursor getMouseCursor(HyperlinkType type) { |
107 |
private static synchronized Cursor getMouseCursor(HyperlinkType type) { |
107 |
switch (type) { |
108 |
switch (type) { |
108 |
case GO_TO_DECLARATION: |
109 |
case GO_TO_DECLARATION: |
|
|
110 |
case GO_TO_ALT_DECLARATION: |
109 |
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); |
111 |
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); |
110 |
default: |
112 |
default: |
111 |
throw new UnsupportedOperationException(); |
113 |
throw new UnsupportedOperationException(); |
Lines 196-201
Link Here
|
196 |
|
198 |
|
197 |
Preferences prefs = MimeLookup.getLookup(DocumentUtilities.getMimeType(component)).lookup(Preferences.class); |
199 |
Preferences prefs = MimeLookup.getLookup(DocumentUtilities.getMimeType(component)).lookup(Preferences.class); |
198 |
this.actionKeyMask = prefs.getInt(SimpleValueNames.HYPERLINK_ACTIVATION_MODIFIERS, InputEvent.CTRL_DOWN_MASK); |
200 |
this.actionKeyMask = prefs.getInt(SimpleValueNames.HYPERLINK_ACTIVATION_MODIFIERS, InputEvent.CTRL_DOWN_MASK); |
|
|
201 |
this.altActionKeyMask = prefs.getInt(SimpleValueNames.ALT_HYPERLINK_ACTIVATION_MODIFIERS, InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK); |
199 |
} |
202 |
} |
200 |
|
203 |
|
201 |
public void mouseMoved(MouseEvent e) { |
204 |
public void mouseMoved(MouseEvent e) { |
Lines 221-227
Link Here
|
221 |
} |
224 |
} |
222 |
|
225 |
|
223 |
private HyperlinkType getHyperlinkType(InputEvent e) { |
226 |
private HyperlinkType getHyperlinkType(InputEvent e) { |
224 |
return ((e.getModifiers() | e.getModifiersEx()) & actionKeyMask) == actionKeyMask ? HyperlinkType.GO_TO_DECLARATION : null; |
227 |
int modifiers = e.getModifiers() | e.getModifiersEx(); |
|
|
228 |
if ((modifiers & altActionKeyMask) == altActionKeyMask) { |
229 |
return HyperlinkType.GO_TO_ALT_DECLARATION; |
230 |
} else if ((modifiers & actionKeyMask) == actionKeyMask) { |
231 |
return HyperlinkType.GO_TO_DECLARATION; |
232 |
} |
233 |
return null; |
225 |
} |
234 |
} |
226 |
|
235 |
|
227 |
private void performHyperlinking(int position, HyperlinkType type) { |
236 |
private void performHyperlinking(int position, HyperlinkType type) { |
Lines 357-364
Link Here
|
357 |
} |
366 |
} |
358 |
|
367 |
|
359 |
public void keyReleased(KeyEvent e) { |
368 |
public void keyReleased(KeyEvent e) { |
360 |
if ((e.getModifiers() & actionKeyMask) == 0) |
369 |
if (getHyperlinkType(e) == null) { |
361 |
unHyperlink(true); |
370 |
unHyperlink(true); |
|
|
371 |
} |
362 |
} |
372 |
} |
363 |
|
373 |
|
364 |
public void keyPressed(KeyEvent e) { |
374 |
public void keyPressed(KeyEvent e) { |