Skip to content

Commit 71c6e61

Browse files
a544jhjamo
authored andcommitted
small refactor
1 parent 7dd10ea commit 71c6e61

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/ui/PreferencesUIFactory.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public void showPreferencesDialog(final ActionListener dialogListener) {
8585
ActionListener closeListener = new ActionListener() {
8686
@Override
8787
public void actionPerformed(ActionEvent e) {
88-
panel = null;
89-
dialog = null;
88+
destroyDialog();
9089
dialogListener.actionPerformed(e);
9190
}
9291
};
@@ -102,8 +101,7 @@ public void actionPerformed(ActionEvent e) {
102101
dialog.addWindowListener(new WindowAdapter() {
103102
@Override
104103
public void windowClosed(WindowEvent we) {
105-
panel = null;
106-
dialog = null;
104+
destroyDialog();
107105
}
108106
});
109107
SwingUtilities.invokeLater(new Runnable() {
@@ -113,4 +111,9 @@ public void run() {
113111
}
114112
});
115113
}
114+
115+
private void destroyDialog() {
116+
panel = null;
117+
dialog = null;
118+
}
116119
}

0 commit comments

Comments
 (0)