Browse Source

Add read only new alias manager dialog.

Change-Id: I4d367f83d06c6de965c7b383ea7b3d22a66e6def
Reviewed-on: http://gerrit.dmdirc.com/3531
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
changes/31/3531/5
Greg Holmes 10 years ago
parent
commit
1531c68e7e

+ 12
- 0
src/com/dmdirc/addons/ui_swing/components/GenericTableModel.java View File

@@ -106,6 +106,18 @@ public class GenericTableModel<T> extends AbstractTableModel {
106 106
         }
107 107
     }
108 108
 
109
+    /**
110
+     * Returns the value at the specified row.
111
+     *
112
+     * @param rowIndex Index to retrieve
113
+     *
114
+     * @return Value at the specified row
115
+     */
116
+    public T getValue(final int rowIndex) {
117
+        Preconditions.checkElementIndex(rowIndex, values.size());
118
+        return values.get(rowIndex);
119
+    }
120
+
109 121
     /**
110 122
      * Sets the name of the header for a specific column.
111 123
      *

+ 15
- 1
src/com/dmdirc/addons/ui_swing/components/menubar/SettingsMenu.java View File

@@ -53,18 +53,22 @@ public class SettingsMenu extends JMenu implements ActionListener {
53 53
     private final DialogProvider<SwingPreferencesDialog> prefsDialogProvider;
54 54
     /** Provider of alias manager dialogs. */
55 55
     private final DialogProvider<AliasManagerDialog> aliasDialogProvider;
56
+    /** Provider of alias manager dialogs. */
57
+    private final DialogProvider<com.dmdirc.addons.ui_swing.dialogs.newaliases.AliasManagerDialog> newAliasDialogProvider;
56 58
 
57 59
     @Inject
58 60
     public SettingsMenu(
59 61
             final DialogProvider<ProfileManagerDialog> profileDialogProvider,
60 62
             final DialogProvider<ActionsManagerDialog> actionsDialogProvider,
61 63
             final DialogProvider<SwingPreferencesDialog> prefsDialogProvider,
62
-            final DialogProvider<AliasManagerDialog> aliasDialogProvider) {
64
+            final DialogProvider<AliasManagerDialog> aliasDialogProvider,
65
+            final DialogProvider<com.dmdirc.addons.ui_swing.dialogs.newaliases.AliasManagerDialog> newAliasDialogProvider) {
63 66
         super("Settings");
64 67
         this.profileDialogProvider = profileDialogProvider;
65 68
         this.actionsDialogProvider = actionsDialogProvider;
66 69
         this.prefsDialogProvider = prefsDialogProvider;
67 70
         this.aliasDialogProvider = aliasDialogProvider;
71
+        this.newAliasDialogProvider = newAliasDialogProvider;
68 72
 
69 73
         setMnemonic('e');
70 74
         initSettingsMenu();
@@ -105,6 +109,13 @@ public class SettingsMenu extends JMenu implements ActionListener {
105 109
         menuItem.setActionCommand("Aliases");
106 110
         menuItem.addActionListener(this);
107 111
         add(menuItem);
112
+
113
+        menuItem = new JMenuItem();
114
+        menuItem.setMnemonic('l');
115
+        menuItem.setText("New Alias Manager");
116
+        menuItem.setActionCommand("NewAliases");
117
+        menuItem.addActionListener(this);
118
+        add(menuItem);
108 119
     }
109 120
 
110 121
     @Override
@@ -122,6 +133,9 @@ public class SettingsMenu extends JMenu implements ActionListener {
122 133
             case "Aliases":
123 134
                 aliasDialogProvider.displayOrRequestFocus();
124 135
                 break;
136
+            case "NewAliases":
137
+                newAliasDialogProvider.displayOrRequestFocus();
138
+                break;
125 139
         }
126 140
     }
127 141
 

+ 60
- 0
src/com/dmdirc/addons/ui_swing/dialogs/newaliases/AliasManagerController.java View File

@@ -0,0 +1,60 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
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.addons.ui_swing.dialogs.newaliases;
24
+
25
+/**
26
+ * Alias manager dialog controller reacts to actions in the UI.
27
+ */
28
+public class AliasManagerController {
29
+
30
+    private final AliasManagerModel model;
31
+    private final AliasManagerDialog dialog;
32
+
33
+    public AliasManagerController(final AliasManagerDialog dialog,
34
+            final AliasManagerModel model) {
35
+        this.model = model;
36
+        this.dialog = dialog;
37
+    }
38
+
39
+    public void addAlias(final String name, final int minArguments, final String substitutions) {
40
+        model.addAlias(name, minArguments, substitutions);
41
+    }
42
+
43
+    public void removeAlias(final String name) {
44
+        model.removeAlias(name);
45
+    }
46
+
47
+    public void editAlias(final String name, final int minArguments, final String substitutions) {
48
+        model.editAlias(name, minArguments, substitutions);
49
+    }
50
+
51
+    public void saveAndCloseDialog() {
52
+        model.save();
53
+        dialog.dispose();
54
+    }
55
+
56
+    public void discardAndCloseDialog() {
57
+        dialog.dispose();
58
+    }
59
+
60
+}

+ 119
- 0
src/com/dmdirc/addons/ui_swing/dialogs/newaliases/AliasManagerDialog.java View File

@@ -0,0 +1,119 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
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.addons.ui_swing.dialogs.newaliases;
24
+
25
+import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
26
+import com.dmdirc.addons.ui_swing.injection.MainWindow;
27
+import com.dmdirc.interfaces.ui.AliasDialogModel;
28
+
29
+import java.awt.Dimension;
30
+import java.awt.Window;
31
+
32
+import javax.inject.Inject;
33
+import javax.swing.JButton;
34
+import javax.swing.JLabel;
35
+import javax.swing.JPanel;
36
+import javax.swing.JScrollPane;
37
+import javax.swing.JSpinner;
38
+import javax.swing.JSplitPane;
39
+import javax.swing.JTable;
40
+import javax.swing.JTextArea;
41
+import javax.swing.JTextField;
42
+
43
+import net.miginfocom.layout.PlatformDefaults;
44
+import net.miginfocom.swing.MigLayout;
45
+
46
+/**
47
+ * Dialog to list and change command aliases.
48
+ */
49
+public class AliasManagerDialog extends StandardDialog {
50
+
51
+    private static final long serialVersionUID = 1;
52
+    private final AliasManagerModel model;
53
+    private final AliasManagerController controller;
54
+    private final AliasManagerLinker linker;
55
+
56
+    @Inject
57
+    public AliasManagerDialog(@MainWindow final Window mainFrame,
58
+            final AliasDialogModel dialogModel) {
59
+        super(mainFrame, ModalityType.DOCUMENT_MODAL);
60
+        this.model = new AliasManagerModel(dialogModel);
61
+        controller = new AliasManagerController(this, model);
62
+        linker = new AliasManagerLinker(controller, model, this);
63
+        final JTable aliasList = new JTable();
64
+        final JTextField command = new JTextField();
65
+        final JSpinner argumentsNumber = new JSpinner();
66
+        final JTextArea response = new JTextArea();
67
+        final JButton addAlias = new JButton("Add Alias");
68
+        final JButton deleteAlias = new JButton("Delete Alias");
69
+        getOkButton();
70
+        getCancelButton();
71
+        setLayout(new MigLayout("fill, pack"));
72
+        setMinimumSize(new Dimension(800, 400));
73
+        final JScrollPane scrollPane = new JScrollPane(aliasList);
74
+        aliasList.setPreferredScrollableViewportSize(new Dimension(800, 150));
75
+        scrollPane.setMinimumSize(new Dimension(750, 150));
76
+        final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, scrollPane,
77
+                getAliasDetails(command, argumentsNumber, response));
78
+        splitPane.setDividerSize((int) PlatformDefaults.getPanelInsets(0).getValue());
79
+
80
+        add(splitPane, "spanx 5, grow, push, wrap");
81
+        add(addAlias, "split 2, sgx button");
82
+        add(deleteAlias, "sgx button");
83
+        add(getLeftButton(), "sgx button");
84
+        add(getRightButton(), "sgx button");
85
+
86
+        linker.bindCommandList(aliasList);
87
+        linker.bindCommand(command);
88
+        linker.bindArgumentsNumber(argumentsNumber);
89
+        linker.bindResponse(response);
90
+        linker.bindAddAlias(addAlias);
91
+        linker.bindDeleteAlias(deleteAlias);
92
+        linker.bindOKButton(getOkButton());
93
+        linker.bindCancelButton(getCancelButton());
94
+        model.load();
95
+    }
96
+
97
+    /**
98
+     * Creates a panel showing all alias details.
99
+     *
100
+     * @param command         Command name
101
+     * @param argumentsNumber Number of arguments
102
+     * @param response        Alias substitution
103
+     *
104
+     * @return Panel to display
105
+     */
106
+    private JPanel getAliasDetails(final JTextField command,
107
+            final JSpinner argumentsNumber, final JTextArea response) {
108
+        final JPanel aliasDetails = new JPanel();
109
+        aliasDetails.setLayout(new MigLayout("fill, ins 0"));
110
+        aliasDetails.add(new JLabel("Command: "));
111
+        aliasDetails.add(command, "sgy args, growx, pushx");
112
+        aliasDetails.add(new JLabel("#Arguments: "));
113
+        aliasDetails.add(argumentsNumber, "sgy args, growx, pushx, wrap");
114
+        aliasDetails.add(new JLabel("Response: "));
115
+        aliasDetails.add(new JScrollPane(response), "span 3, grow, push, wrap");
116
+        return aliasDetails;
117
+    }
118
+
119
+}

+ 163
- 0
src/com/dmdirc/addons/ui_swing/dialogs/newaliases/AliasManagerLinker.java View File

@@ -0,0 +1,163 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
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.addons.ui_swing.dialogs.newaliases;
24
+
25
+import com.dmdirc.addons.ui_swing.components.GenericTableModel;
26
+import com.dmdirc.commandparser.aliases.Alias;
27
+
28
+import com.google.common.base.Optional;
29
+
30
+import java.awt.event.ActionEvent;
31
+import java.awt.event.ActionListener;
32
+import java.beans.PropertyChangeEvent;
33
+import java.beans.PropertyChangeListener;
34
+
35
+import javax.swing.JButton;
36
+import javax.swing.JSpinner;
37
+import javax.swing.JTable;
38
+import javax.swing.JTextArea;
39
+import javax.swing.JTextField;
40
+import javax.swing.ListSelectionModel;
41
+import javax.swing.event.ListSelectionEvent;
42
+import javax.swing.event.ListSelectionListener;
43
+
44
+/**
45
+ * Links the Alias Manager Dialog with its controller and model.
46
+ */
47
+public class AliasManagerLinker {
48
+
49
+    private final AliasManagerController controller;
50
+    private final AliasManagerModel model;
51
+    private final AliasManagerDialog dialog;
52
+
53
+    public AliasManagerLinker(final AliasManagerController controller,
54
+            final AliasManagerModel model,
55
+            final AliasManagerDialog dialog) {
56
+        this.controller = controller;
57
+        this.model = model;
58
+        this.dialog = dialog;
59
+    }
60
+
61
+    public void bindCommandList(final JTable commandList) {
62
+        final GenericTableModel<Alias> commandModel = new GenericTableModel<>(
63
+                Alias.class, "getName", "getMinArguments", "getSubstitution");
64
+        commandModel.setHeaderNames("Name", "Minimum Arguments", "Substitution");
65
+        commandList.setModel(commandModel);
66
+        commandList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
67
+        commandList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
68
+            @Override
69
+            public void valueChanged(final ListSelectionEvent e) {
70
+                final int index = commandList.getSelectedRow();
71
+                if (index == -1) {
72
+                    model.setSelectedAlias(Optional.<Alias>absent());
73
+                } else {
74
+                    model.setSelectedAlias(Optional.fromNullable(commandModel.getValue(index)));
75
+                }
76
+            }
77
+        });
78
+        model.addPropertyChangeListener("aliases", new PropertyChangeListener() {
79
+
80
+            @Override
81
+            public void propertyChange(final PropertyChangeEvent evt) {
82
+                for (Alias alias : model.getAliases()) {
83
+                    commandModel.addValue(alias);
84
+                }
85
+            }
86
+        });
87
+    }
88
+
89
+    public void bindCommand(final JTextField command) {
90
+        command.setEnabled(false);
91
+        model.addPropertyChangeListener("selectedAlias", new PropertyChangeListener() {
92
+
93
+            @Override
94
+            public void propertyChange(PropertyChangeEvent evt) {
95
+                final Optional<Alias> selectedAlias = model.getSelectedAlias();
96
+                command.setEnabled(selectedAlias.isPresent());
97
+                if (selectedAlias.isPresent()) {
98
+                    command.setText(selectedAlias.get().getName());
99
+                } else {
100
+                    command.setText("");
101
+                }
102
+            }
103
+        });
104
+    }
105
+
106
+    public void bindArgumentsNumber(final JSpinner argumentsNumber) {
107
+        argumentsNumber.setEnabled(false);
108
+        model.addPropertyChangeListener("selectedAlias", new PropertyChangeListener() {
109
+
110
+            @Override
111
+            public void propertyChange(PropertyChangeEvent evt) {
112
+                final Optional<Alias> selectedAlias = model.getSelectedAlias();
113
+                argumentsNumber.setEnabled(selectedAlias.isPresent());
114
+                if (selectedAlias.isPresent()) {
115
+                    argumentsNumber.setValue(model.getSelectedAlias().get().getMinArguments());
116
+                } else {
117
+                    argumentsNumber.setValue(0);
118
+                }
119
+            }
120
+        });
121
+    }
122
+
123
+    public void bindResponse(final JTextArea response) {
124
+        response.setEnabled(false);
125
+        model.addPropertyChangeListener("selectedAlias", new PropertyChangeListener() {
126
+
127
+            @Override
128
+            public void propertyChange(PropertyChangeEvent evt) {
129
+                final Optional<Alias> selectedAlias = model.getSelectedAlias();
130
+                response.setEnabled(selectedAlias.isPresent());
131
+                if (selectedAlias.isPresent()) {
132
+                    response.setText(model.getSelectedAlias().get().getSubstitution());
133
+                } else {
134
+                    response.setText("");
135
+                }
136
+            }
137
+        });
138
+    }
139
+
140
+    public void bindAddAlias(final JButton addAlias) {
141
+        addAlias.setEnabled(false);
142
+    }
143
+
144
+    public void bindDeleteAlias(final JButton deleteAlias) {
145
+        deleteAlias.setEnabled(false);
146
+    }
147
+
148
+    public void bindOKButton(final JButton okButton) {
149
+        okButton.setEnabled(false);
150
+    }
151
+
152
+    public void bindCancelButton(final JButton cancelButton) {
153
+        cancelButton.setEnabled(true);
154
+        cancelButton.addActionListener(new ActionListener() {
155
+
156
+            @Override
157
+            public void actionPerformed(final ActionEvent e) {
158
+                controller.discardAndCloseDialog();
159
+            }
160
+        });
161
+    }
162
+
163
+}

+ 114
- 0
src/com/dmdirc/addons/ui_swing/dialogs/newaliases/AliasManagerModel.java View File

@@ -0,0 +1,114 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
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.addons.ui_swing.dialogs.newaliases;
24
+
25
+import com.dmdirc.commandparser.aliases.Alias;
26
+import com.dmdirc.interfaces.ui.AliasDialogModel;
27
+
28
+import com.google.common.base.Optional;
29
+
30
+import java.beans.PropertyChangeListener;
31
+import java.beans.PropertyChangeListenerProxy;
32
+import java.beans.PropertyChangeSupport;
33
+import java.util.Collection;
34
+
35
+/**
36
+ * Alias manager dialog model stores state of the UI, mostly proxying to the core model.
37
+ */
38
+public class AliasManagerModel {
39
+
40
+    /** Profile change support. */
41
+    private final PropertyChangeSupport pcs;
42
+    /** Core alias dialog mode. */
43
+    private final AliasDialogModel model;
44
+
45
+    public AliasManagerModel(final AliasDialogModel model) {
46
+        this.model = model;
47
+        pcs = new PropertyChangeSupport(this);
48
+    }
49
+
50
+    public void load() {
51
+        final PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners();
52
+        for (PropertyChangeListener listener : listeners) {
53
+            if (listener instanceof PropertyChangeListenerProxy) {
54
+                final PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener;
55
+                pcs.firePropertyChange(proxy.getPropertyName(), null, null);
56
+            }
57
+        }
58
+    }
59
+
60
+    public Collection<Alias> getAliases() {
61
+        return model.getAliases();
62
+    }
63
+
64
+    public Optional<Alias> getAlias(final String name) {
65
+        return model.getAlias(name);
66
+    }
67
+
68
+    public void addAlias(final String name, final int minArguments, final String substitution) {
69
+        model.addAlias(name, minArguments, substitution);
70
+        pcs.firePropertyChange("addAlias", "", name);
71
+    }
72
+
73
+    public void editAlias(final String name, final int minArguments, final String substitution) {
74
+        model.editAlias(null, minArguments, null);
75
+        pcs.firePropertyChange("editAlias", name, name);
76
+    }
77
+
78
+    public void renameAlias(final String oldName, final String newName) {
79
+        model.renameAlias(oldName, newName);
80
+        pcs.firePropertyChange("renameAlias", oldName, newName);
81
+    }
82
+
83
+    public void removeAlias(final String name) {
84
+        model.removeAlias(name);
85
+        pcs.firePropertyChange("deleteAlias", name, "");
86
+    }
87
+
88
+    public void setSelectedAlias(final Optional<Alias> alias) {
89
+        final Optional<Alias> oldAlias = model.getSelectedAlias();
90
+        model.setSelectedAlias(alias);
91
+        pcs.firePropertyChange("selectedAlias", oldAlias, alias);
92
+    }
93
+
94
+    public Optional<Alias> getSelectedAlias() {
95
+        return model.getSelectedAlias();
96
+    }
97
+
98
+    public void save() {
99
+        model.save();
100
+    }
101
+
102
+    public void addPropertyChangeListener(final PropertyChangeListener listener) {
103
+        pcs.addPropertyChangeListener(listener);
104
+    }
105
+
106
+    public void addPropertyChangeListener(final String name, final PropertyChangeListener listener) {
107
+        pcs.addPropertyChangeListener(name, listener);
108
+    }
109
+
110
+    public void removePropertyChangeListener(final PropertyChangeListener listener) {
111
+        pcs.removePropertyChangeListener(listener);
112
+    }
113
+
114
+}

+ 15
- 0
src/com/dmdirc/addons/ui_swing/injection/DialogModule.java View File

@@ -41,12 +41,15 @@ import com.dmdirc.addons.ui_swing.dialogs.profiles.ProfileManagerDialog;
41 41
 import com.dmdirc.addons.ui_swing.dialogs.serversetting.ServerSettingsDialog;
42 42
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingRestartDialog;
43 43
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingUpdaterDialog;
44
+import com.dmdirc.commandparser.aliases.AliasManager;
45
+import com.dmdirc.commandparser.aliases.CoreAliasDialogModel;
44 46
 import com.dmdirc.config.prefs.PreferencesManager;
45 47
 import com.dmdirc.interfaces.CommandController;
46 48
 import com.dmdirc.interfaces.Connection;
47 49
 import com.dmdirc.interfaces.LifecycleController;
48 50
 import com.dmdirc.interfaces.config.ConfigProvider;
49 51
 import com.dmdirc.interfaces.config.IdentityFactory;
52
+import com.dmdirc.interfaces.ui.AliasDialogModel;
50 53
 import com.dmdirc.plugins.ServiceManager;
51 54
 
52 55
 import java.awt.Window;
@@ -79,6 +82,11 @@ public class DialogModule {
79 82
     public static @interface ForSettings {
80 83
     }
81 84
 
85
+    @Provides
86
+    public AliasDialogModel getAliasDialogModel(final AliasManager aliasManager) {
87
+        return new CoreAliasDialogModel(aliasManager);
88
+    }
89
+
82 90
     @Provides
83 91
     @Singleton
84 92
     public DialogProvider<NewServerDialog> getNewServerDialogProvider(
@@ -107,6 +115,13 @@ public class DialogModule {
107 115
         return new DialogProvider<>(provider);
108 116
     }
109 117
 
118
+    @Provides
119
+    @Singleton
120
+    public DialogProvider<com.dmdirc.addons.ui_swing.dialogs.newaliases.AliasManagerDialog> getNewAliasManagerDialogProvider(
121
+            final Provider<com.dmdirc.addons.ui_swing.dialogs.newaliases.AliasManagerDialog> provider) {
122
+        return new DialogProvider<>(provider);
123
+    }
124
+
110 125
     @Provides
111 126
     @Singleton
112 127
     public DialogProvider<ErrorListDialog> getErrorListDialogProvider(

Loading…
Cancel
Save