command line hook for questionnaire url argument.
[jalview.git] / src / jalview / gui / AnnotationLabels.java
index a454cf9..783c905 100755 (executable)
@@ -226,37 +226,20 @@ public class AnnotationLabels extends JPanel implements MouseListener,
      */
     boolean editLabelDescription(AlignmentAnnotation annotation)
     {
-      JLabel idlabel = new JLabel(  "      Annotation Label ");
-      JLabel desclabel = new JLabel("Annotation Description ");
-      idlabel.setFont(new Font("Courier", Font.PLAIN, 12));
-      desclabel.setFont(new Font("Courier", Font.PLAIN, 12));
-      JTextField id = new JTextField(annotation.label, 40);
-      JTextField description = new JTextField(annotation.description, 40);
-      JPanel panel = new JPanel(new BorderLayout());
-      JPanel panel2 = new JPanel(new BorderLayout());
-      panel2.add(idlabel, BorderLayout.WEST);
-      panel2.add(id, BorderLayout.CENTER);
-      panel.add(panel2, BorderLayout.NORTH);
-      panel2 = new JPanel(new BorderLayout());
-      panel2.add(desclabel, BorderLayout.WEST);
-      panel2.add(description, BorderLayout.CENTER);
-      panel.add(panel2, BorderLayout.SOUTH);
-
-
-       int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
-          panel, "Edit Annotation Name/Description",
-          JOptionPane.OK_CANCEL_OPTION );
-
-
-        if (reply != JOptionPane.OK_OPTION )
-        {
-            return false;
-        }
+      EditNameDialog dialog = new EditNameDialog(annotation.label,
+                                                 annotation.description,
+                                                 "       Annotation Name ",
+                                                 "Annotation Description ",
+                                                 "Edit Annotation Name/Description");
 
+      if (!dialog.accept)
+      {
+        return false;
+      }
 
-        annotation.label = id.getText().trim();
+        annotation.label = dialog.getName();
 
-        String text = description.getText().trim();
+        String text = dialog.getDescription();
         if(text.length()==0)
           text = null;
         annotation.description = text;
@@ -375,12 +358,13 @@ public class AnnotationLabels extends JPanel implements MouseListener,
 
       getSelectedRow(evt.getY() - scrollOffset);
 
-      if(selectedRow>-1)
+      if(selectedRow>-1
+         && ap.av.alignment.getAlignmentAnnotation().length>selectedRow)
       {
         String desc = ap.av.alignment.
             getAlignmentAnnotation()[selectedRow].description;
 
-        if (desc != null && !desc.equals("New Description"))
+        if (desc != null && !desc.equals("New description"))
           setToolTipText(ap.av.alignment.
                          getAlignmentAnnotation()[selectedRow].description);