浏览代码

Only evalulate action components if they're actually present in the

target. Fixes issue 2582.
tags/0.6.3m2a1
Chris Smith 15 年前
父节点
当前提交
5001fa568a
共有 1 个文件被更改,包括 14 次插入7 次删除
  1. 14
    7
      src/com/dmdirc/actions/ActionSubstitutor.java

+ 14
- 7
src/com/dmdirc/actions/ActionSubstitutor.java 查看文件

@@ -111,10 +111,13 @@ public class ActionSubstitutor {
111 111
             if (args[i] != null) {
112 112
                 for (ActionComponent comp : ActionManager.getCompatibleComponents(myClass)) {
113 113
                     final String needle = "${" + i + "." + comp.toString() + "}";
114
-                    final Object replacement = comp.get(args[i]);
115 114
 
116
-                    if (replacement != null) {
117
-                        doReplacement(target, needle, replacement.toString());
115
+                    if (target.indexOf(needle) > -1) {
116
+                        final Object replacement = comp.get(args[i]);
117
+
118
+                        if (replacement != null) {
119
+                            doReplacement(target, needle, replacement.toString());
120
+                        }
118 121
                     }
119 122
                 }
120 123
             }
@@ -163,10 +166,13 @@ public class ActionSubstitutor {
163 166
                     
164 167
                     for (ActionComponent comp : ActionManager.getCompatibleComponents(Server.class)) {
165 168
                         final String key = "${" + comp.toString() + "}";
166
-                        final Object res = comp.get(((FrameContainer) args[0]).getServer());
167 169
 
168
-                        if (res != null) {
169
-                            doReplacement(target, key, res.toString());
170
+                        if (target.indexOf(key) > -1) {
171
+                            final Object res = comp.get(((FrameContainer) args[0]).getServer());
172
+
173
+                            if (res != null) {
174
+                                doReplacement(target, key, res.toString());
175
+                            }
170 176
                         }
171 177
                     }
172 178
                 }
@@ -201,7 +207,8 @@ public class ActionSubstitutor {
201 207
      * @return True if word substitutions are supported, false otherwise.
202 208
      */
203 209
     public boolean usesWordSubstitutions() {
204
-        return type.getType().getArgTypes().length > 2 && type.getType().getArgTypes()[2] == String[].class;
210
+        return type.getType().getArgTypes().length > 2
211
+                && type.getType().getArgTypes()[2] == String[].class;
205 212
     }
206 213
     
207 214
     /**

正在加载...
取消
保存