Преглед изворни кода

Add link clicking actions required for issue 2932

Change-Id: Iefb00f7a27b39d664c8cee4923c01409431bc3df
Reviewed-on: http://gerrit.dmdirc.com/333
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Tested-by: Gregory Holmes <greboid@dmdirc.com>
tags/0.6.3b1
Gregory Holmes пре 14 година
родитељ
комит
0acde166ca

+ 9
- 1
src/com/dmdirc/actions/CoreActionType.java Прегледај датотеку

@@ -27,6 +27,7 @@ import com.dmdirc.actions.interfaces.ActionMetaType;
27 27
 import com.dmdirc.actions.metatypes.ActionEvents;
28 28
 import com.dmdirc.actions.metatypes.ChannelEvents;
29 29
 import com.dmdirc.actions.metatypes.ClientEvents;
30
+import com.dmdirc.actions.metatypes.LinkEvents;
30 31
 import com.dmdirc.actions.metatypes.PluginEvents;
31 32
 import com.dmdirc.actions.metatypes.QueryEvents;
32 33
 import com.dmdirc.actions.metatypes.ServerEvents;
@@ -216,7 +217,14 @@ public enum CoreActionType implements ActionType {
216 217
     /** Action updated. */
217 218
     ACTION_UPDATED(ActionEvents.ACTION_EVENT, "Action updated"),
218 219
     /** Action deleted. */
219
-    ACTION_DELETED(ActionEvents.ACTION_DELETED, "Action deleted");
220
+    ACTION_DELETED(ActionEvents.ACTION_DELETED, "Action deleted"),
221
+
222
+    /** Channel clicked. */
223
+    LINK_CHANNEL_CLICKED(LinkEvents.CHANNEL_CLICKED, "A channel link was clicked"),
224
+    /** Channel clicked. */
225
+    LINK_NICKNAME_CLICKED(LinkEvents.NICKNAME_CLICKED, "A nickname link was clicked"),
226
+    /** Link clicked. */
227
+    LINK_URL_CLICKED(LinkEvents.LINK_CLICKED, "A Link was clicked");
220 228
     
221 229
     /** The type of this action. */
222 230
     private final ActionMetaType type;

+ 79
- 0
src/com/dmdirc/actions/metatypes/LinkEvents.java Прегледај датотеку

@@ -0,0 +1,79 @@
1
+/*
2
+ * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.actions.metatypes;
24
+
25
+import com.dmdirc.actions.interfaces.ActionMetaType;
26
+
27
+/**
28
+ * Defines link-related events.
29
+ *
30
+ * @author Chris
31
+ */
32
+public enum LinkEvents implements ActionMetaType {
33
+
34
+    /** URL Link clicked. */
35
+    LINK_CLICKED(new String[]{"URL"}, String.class),
36
+    /** Channel link clicked. */
37
+    CHANNEL_CLICKED(new String[]{"Channel"}, String.class),
38
+    /** Nickname link clicked. */
39
+    NICKNAME_CLICKED(new String[]{"Nickname"}, String.class);
40
+    /** The names of the arguments for this meta type. */
41
+    private String[] argNames;
42
+    /** The classes of the arguments for this meta type. */
43
+    private Class[] argTypes;
44
+
45
+    /**
46
+     * Creates a new instance of this meta-type.
47
+     *
48
+     * @param argNames The names of the meta-type's arguments
49
+     * @param argTypes The types of the meta-type's arguments
50
+     */
51
+    LinkEvents(final String[] argNames, final Class... argTypes) {
52
+        this.argNames = argNames;
53
+        this.argTypes = argTypes;
54
+    }
55
+
56
+    /** {@inheritDoc} */
57
+    @Override
58
+    public int getArity() {
59
+        return argNames.length;
60
+    }
61
+
62
+    /** {@inheritDoc} */
63
+    @Override
64
+    public Class[] getArgTypes() {
65
+        return argTypes;
66
+    }
67
+
68
+    /** {@inheritDoc} */
69
+    @Override
70
+    public String[] getArgNames() {
71
+        return argNames;
72
+    }
73
+
74
+    /** {@inheritDoc} */
75
+    @Override
76
+    public String getGroup() {
77
+        return "Link Events";
78
+    }
79
+}

Loading…
Откажи
Сачувај