Browse Source

Fixes issue 3733: SSD per profile performs dont work at all

Change-Id: I899eea7dc76109d5c98b66570a79aaa2081c061b
Reviewed-on: http://gerrit.dmdirc.com/849
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.3
Gregory Holmes 14 years ago
parent
commit
0afc286c4f

+ 11
- 7
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/PerformPanel.java View File

77
     /** Perform text area. */
77
     /** Perform text area. */
78
     private JTextArea textarea;
78
     private JTextArea textarea;
79
 
79
 
80
+    /** Active perform. */
81
+    private int activePerform = 0;
82
+
80
     /**
83
     /**
81
      * Creates a new instance of IgnoreList.
84
      * Creates a new instance of IgnoreList.
82
      *
85
      *
84
      */
87
      */
85
     public PerformPanel(final Server server) {
88
     public PerformPanel(final Server server) {
86
         super();
89
         super();
87
-
88
         this.server = server;
90
         this.server = server;
89
 
91
 
90
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
92
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
123
         target.addActionListener(this);
125
         target.addActionListener(this);
124
     }
126
     }
125
 
127
 
128
+
126
     /** Loads the perform actions. */
129
     /** Loads the perform actions. */
127
     private void loadPerforms() {
130
     private void loadPerforms() {
128
         serverAction = PerformWrapper.getPerformWrapper().
131
         serverAction = PerformWrapper.getPerformWrapper().
155
         if (profileNetworkAction == null) {
158
         if (profileNetworkAction == null) {
156
             profileNetworkPerform = "";
159
             profileNetworkPerform = "";
157
         } else {
160
         } else {
158
-            profileNetworkPerform = implode(profileServerAction.getResponse());
161
+            profileNetworkPerform = implode(profileNetworkAction.getResponse());
159
         }
162
         }
160
     }
163
     }
161
 
164
 
198
 
201
 
199
     /** Stores the text currently in the textarea into the perform strings. */
202
     /** Stores the text currently in the textarea into the perform strings. */
200
     private void storeText() {
203
     private void storeText() {
201
-        switch (target.getSelectedIndex()) {
204
+        switch (activePerform) {
202
             case 0:
205
             case 0:
203
                 networkPerform = textarea.getText();
206
                 networkPerform = textarea.getText();
204
                 break;
207
                 break;
220
     public void savePerforms() {
223
     public void savePerforms() {
221
         storeText();
224
         storeText();
222
 
225
 
223
-        if (!serverPerform.isEmpty() || serverAction != null) {
226
+        if (!serverPerform.isEmpty()) {
224
             if (serverAction == null) {
227
             if (serverAction == null) {
225
                 serverAction = PerformWrapper.getPerformWrapper().
228
                 serverAction = PerformWrapper.getPerformWrapper().
226
                         createActionForServer(server.getName());
229
                         createActionForServer(server.getName());
229
             serverAction.save();
232
             serverAction.save();
230
         }
233
         }
231
 
234
 
232
-        if (!networkPerform.isEmpty() || networkAction != null) {
235
+        if (!networkPerform.isEmpty()) {
233
             if (networkAction == null) {
236
             if (networkAction == null) {
234
                 networkAction = PerformWrapper.getPerformWrapper().
237
                 networkAction = PerformWrapper.getPerformWrapper().
235
                         createActionForNetwork(server.getNetwork());
238
                         createActionForNetwork(server.getNetwork());
238
             networkAction.save();
241
             networkAction.save();
239
         }
242
         }
240
 
243
 
241
-        if (!profileNetworkPerform.isEmpty() || profileNetworkAction != null) {
244
+        if (!profileNetworkPerform.isEmpty()) {
242
             if (profileNetworkAction == null) {
245
             if (profileNetworkAction == null) {
243
                 profileNetworkAction = PerformWrapper.getPerformWrapper().
246
                 profileNetworkAction = PerformWrapper.getPerformWrapper().
244
                         createActionForNetwork(server.getNetwork(),
247
                         createActionForNetwork(server.getNetwork(),
248
             profileNetworkAction.save();
251
             profileNetworkAction.save();
249
         }
252
         }
250
 
253
 
251
-        if (!profileServerPerform.isEmpty() || profileServerAction != null) {
254
+        if (!profileServerPerform.isEmpty()) {
252
             if (profileServerAction == null) {
255
             if (profileServerAction == null) {
253
                 profileServerAction = PerformWrapper.getPerformWrapper().
256
                 profileServerAction = PerformWrapper.getPerformWrapper().
254
                         createActionForServer(server.getName(),
257
                         createActionForServer(server.getName(),
267
     @Override
270
     @Override
268
     public void actionPerformed(final ActionEvent e) {
271
     public void actionPerformed(final ActionEvent e) {
269
         storeText();
272
         storeText();
273
+        activePerform = target.getSelectedIndex();
270
         populatePerform();
274
         populatePerform();
271
     }
275
     }
272
 
276
 

Loading…
Cancel
Save