|
@@ -22,7 +22,6 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.ui.messages;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.FrameContainer;
|
26
|
25
|
import com.dmdirc.config.ConfigChangeListener;
|
27
|
26
|
import com.dmdirc.config.IdentityManager;
|
28
|
27
|
import com.dmdirc.logger.ErrorLevel;
|
|
@@ -101,12 +100,15 @@ public final class Styliser {
|
101
|
100
|
private static final String URL_CHANNEL = "(?i)(?<![^\\s])([#&]" + RESERVED_CHARS + "+)";
|
102
|
101
|
|
103
|
102
|
/** Whether or not we should style links. */
|
104
|
|
- private static boolean styleLinks = IdentityManager.getGlobalConfig().getOptionBool("ui", "stylelinks");
|
|
103
|
+ private static boolean styleLinks
|
|
104
|
+ = IdentityManager.getGlobalConfig().getOptionBool("ui", "stylelinks");
|
105
|
105
|
|
106
|
106
|
static {
|
107
|
|
- IdentityManager.getGlobalConfig().addChangeListener("ui", "stylelinks",new ConfigChangeListener() {
|
|
107
|
+ IdentityManager.getGlobalConfig().addChangeListener("ui", "stylelinks",
|
|
108
|
+ new ConfigChangeListener() {
|
108
|
109
|
public void configChanged(final String domain, final String key) {
|
109
|
|
- Styliser.styleLinks = IdentityManager.getGlobalConfig().getOptionBool("ui", "stylelinks");
|
|
110
|
+ Styliser.styleLinks
|
|
111
|
+ = IdentityManager.getGlobalConfig().getOptionBool("ui", "stylelinks");
|
110
|
112
|
}
|
111
|
113
|
});
|
112
|
114
|
}
|
|
@@ -119,11 +121,10 @@ public final class Styliser {
|
119
|
121
|
* Stylises the specified string.
|
120
|
122
|
*
|
121
|
123
|
* @param strings The line to be stylised
|
122
|
|
- * @param context The context of the string to be styled
|
123
|
124
|
*
|
124
|
125
|
* @return StyledDocument for the inputted strings
|
125
|
126
|
*/
|
126
|
|
- public static StyledDocument getStyledString(final String[] strings, final FrameContainer context) {
|
|
127
|
+ public static StyledDocument getStyledString(final String[] strings) {
|
127
|
128
|
final StyledDocument styledDoc = new DefaultStyledDocument();
|
128
|
129
|
|
129
|
130
|
for (int i = 0; i < strings.length; i++) {
|
|
@@ -289,7 +290,8 @@ public final class Styliser {
|
289
|
290
|
toggleLink(attribs);
|
290
|
291
|
|
291
|
292
|
if (attribs.getAttribute(IRCTextAttribute.HYPERLINK) == null) {
|
292
|
|
- attribs.addAttribute(IRCTextAttribute.HYPERLINK, readUntilControl(string.substring(1)));
|
|
293
|
+ attribs.addAttribute(IRCTextAttribute.HYPERLINK,
|
|
294
|
+ readUntilControl(string.substring(1)));
|
293
|
295
|
} else {
|
294
|
296
|
attribs.removeAttribute(IRCTextAttribute.HYPERLINK);
|
295
|
297
|
}
|
|
@@ -299,7 +301,8 @@ public final class Styliser {
|
299
|
301
|
// Channel links
|
300
|
302
|
if (string.charAt(0) == CODE_CHANNEL) {
|
301
|
303
|
if (attribs.getAttribute(IRCTextAttribute.CHANNEL) == null) {
|
302
|
|
- attribs.addAttribute(IRCTextAttribute.CHANNEL, readUntilControl(string.substring(1)));
|
|
304
|
+ attribs.addAttribute(IRCTextAttribute.CHANNEL,
|
|
305
|
+ readUntilControl(string.substring(1)));
|
303
|
306
|
} else {
|
304
|
307
|
attribs.removeAttribute(IRCTextAttribute.CHANNEL);
|
305
|
308
|
}
|
|
@@ -310,7 +313,8 @@ public final class Styliser {
|
310
|
313
|
// Nickname links
|
311
|
314
|
if (string.charAt(0) == CODE_NICKNAME) {
|
312
|
315
|
if (attribs.getAttribute(IRCTextAttribute.NICKNAME) == null) {
|
313
|
|
- attribs.addAttribute(IRCTextAttribute.NICKNAME, readUntilControl(string.substring(1)));
|
|
316
|
+ attribs.addAttribute(IRCTextAttribute.NICKNAME,
|
|
317
|
+ readUntilControl(string.substring(1)));
|
314
|
318
|
} else {
|
315
|
319
|
attribs.removeAttribute(IRCTextAttribute.NICKNAME);
|
316
|
320
|
}
|
|
@@ -389,7 +393,8 @@ public final class Styliser {
|
389
|
393
|
count++;
|
390
|
394
|
setBackground(attribs, string.substring(count, count + 6).toUpperCase());
|
391
|
395
|
if (isStart) {
|
392
|
|
- setDefaultBackground(attribs, string.substring(count, count + 6).toUpperCase());
|
|
396
|
+ setDefaultBackground(attribs,
|
|
397
|
+ string.substring(count, count + 6).toUpperCase());
|
393
|
398
|
}
|
394
|
399
|
count += 6;
|
395
|
400
|
}
|