1010import com .intellij .openapi .project .Project ;
1111import com .intellij .openapi .ui .DialogWrapper ;
1212import com .intellij .ui .table .JBTable ;
13+ import com .intellij .util .messages .MessageBus ;
14+ import de .fraunhofer .iem .swan .assist .comm .MethodNotifier ;
1315import de .fraunhofer .iem .swan .assist .data .MethodWrapper ;
1416import de .fraunhofer .iem .swan .data .Category ;
1517import de .fraunhofer .iem .swan .data .RelevantPart ;
@@ -46,6 +48,8 @@ public class MethodDialog extends DialogWrapper {
4648 private JPanel parametersTabPanel ;
4749 private List <JCheckBox > dataInCheckBoxes , dataOutCheckBoxes ;
4850 private ResourceBundle resourceBundle ;
51+ private MethodWrapper method ;
52+ private Project project ;
4953
5054
5155 /**
@@ -58,14 +62,21 @@ public class MethodDialog extends DialogWrapper {
5862 */
5963 public MethodDialog (HashMap <String , MethodWrapper > methods , String signature , Project project , Set <Category > categories ) {
6064 super (project );
65+ this .project = project ;
6166 this .resourceBundle = ResourceBundle .getBundle ("dialog_messages" );
67+
68+ resourceBundle = ResourceBundle .getBundle ("dialog_messages" );
69+ setTitle (resourceBundle .getString ("MethodDialog.Title" ));
70+
71+
6272 for (MethodWrapper methodWrapper : methods .values ()) {
6373 signatureCbx .addItem (methodWrapper );
6474 }
6575 signatureCbx .setRenderer (new SignatureComboBoxRenderer ());
6676 signatureCbx .setSelectedItem (methods .get (signature ));
6777 previousItem = methods .get (signature );
6878
79+ method = methods .get (signature );
6980 updateCategoryTab (methods .get (signature ), categories );
7081 updateParametersTab (methods .get (signature ));
7182 updatePropertiesTab (methods .get (signature ));
@@ -161,7 +172,6 @@ private void updateCategoryTab(MethodWrapper method, Set<Category> categories) {
161172 } catch (Exception e ) {
162173 checkBox .setToolTipText (category .toString ());
163174 }
164- // cweCheckBoxPanel.setPreferredSize(new java.awt.Dimension(200, 200));
165175 cweCheckBoxPanel .add (checkBox );
166176 } else {
167177 //srmCheckBoxPanel.setPreferredSize(new java.awt.Dimension(200, 200));
@@ -274,7 +284,15 @@ protected void doOKAction() {
274284
275285 if (isOKActionEnabled ()) {
276286 updateMethodData ((MethodWrapper ) signatureCbx .getSelectedItem ());
277- super .doOKAction ();
287+
288+ if (method .getStatus ().equals (MethodWrapper .MethodStatus .NEW )) {
289+ //Notify Summary Tool window that new method was added
290+ MessageBus messageBus = project .getMessageBus ();
291+
292+ MethodNotifier publisher = messageBus .syncPublisher (MethodNotifier .ADD_UPDATE_DELETE_METHOD );
293+ publisher .addNewExistingMethod (method );
294+ super .doOKAction ();
295+ }
278296 }
279297 }
280298
0 commit comments