Revision: 14732
          http://gate.svn.sourceforge.net/gate/?rev=14732&view=rev
Author:   markagreenwood
Date:     2011-12-12 10:57:05 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
 you now can't okay the update site dialog if you haven't specifiec both a name 
and URL

Modified Paths:
--------------
    gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java

Modified: gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java     
2011-12-12 02:17:05 UTC (rev 14731)
+++ gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java     
2011-12-12 10:57:05 UTC (rev 14732)
@@ -44,6 +44,8 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -508,9 +510,9 @@
             if(changes) break;
           }
         }
-        
-        if (!changes) changes = installed.unsavedChanges();
 
+        if(!changes) changes = installed.unsavedChanges();
+
         if(changes
                 && JOptionPane
                         .showConfirmDialog(
@@ -632,12 +634,48 @@
       public void actionPerformed(ActionEvent e) {
         txtName.setText("");
         txtURL.setText("");
-        if(JOptionPane.showConfirmDialog(PluginUpdateManager.this, pnlEdit,
-                "Plugin Repository Info", JOptionPane.OK_CANCEL_OPTION,
-                JOptionPane.QUESTION_MESSAGE, new UpdateSiteIcon(48, 48)) != 
JOptionPane.OK_OPTION)
+
+        final JOptionPane options =
+                new JOptionPane(pnlEdit, JOptionPane.QUESTION_MESSAGE,
+                        JOptionPane.OK_CANCEL_OPTION,
+                        new UpdateSiteIcon(48, 48));
+        final JDialog dialog =
+                new JDialog(PluginUpdateManager.this, "Plugin Repository Info",
+                        true);
+        options.addPropertyChangeListener(new PropertyChangeListener() {
+          public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+
+            if(dialog.isVisible() && (e.getSource() == options)
+                    && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
+
+              if(((Integer)options.getValue()).intValue() == 
JOptionPane.OK_OPTION) {
+
+                if(txtName.getText().trim().equals("")) {
+                  txtName.requestFocusInWindow();
+                  return;
+                }
+                if(txtURL.getText().trim().equals("")) {
+                  txtURL.requestFocusInWindow();
+                  return;
+                }
+              }
+
+              dialog.setVisible(false);
+            }
+          }
+        });
+
+        dialog.setContentPane(options);
+        dialog.pack();
+        dialog.setLocationRelativeTo(PluginUpdateManager.this);
+        dialog.setVisible(true);
+
+        if(((Integer)options.getValue()).intValue() != JOptionPane.OK_OPTION)
           return;
         if(txtName.getText().trim().equals("")) return;
         if(txtURL.getText().trim().equals("")) return;
+
         try {
           updateSites.add(new RemoteUpdateSite(txtName.getText().trim(),
                   new URI(txtURL.getText().trim()), true));

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to