Revision: 14939
http://gate.svn.sourceforge.net/gate/?rev=14939&view=rev
Author: valyt
Date: 2012-01-09 10:23:44 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
Changed the new resource action to pop back the dialog when the resource
creation fails (so that the user can correct the data and try again, without
losing their changes).
Closes feature request #2848709.
Modified Paths:
--------------
gate/trunk/src/gate/gui/NewResourceDialog.java
Modified: gate/trunk/src/gate/gui/NewResourceDialog.java
===================================================================
--- gate/trunk/src/gate/gui/NewResourceDialog.java 2012-01-09 08:34:12 UTC
(rev 14938)
+++ gate/trunk/src/gate/gui/NewResourceDialog.java 2012-01-09 10:23:44 UTC
(rev 14939)
@@ -178,20 +178,25 @@
}// getSelectedParameters()
public synchronized void show(ResourceData rData) {
- this.resourceData = rData;
- nameField.setText("");
- parametersEditor.init(null,
- rData.getParameterList().getInitimeParameters());
- pack();
- setLocationRelativeTo(getOwner());
+ if(rData != null) {
+ this.resourceData = rData;
+ nameField.setText("");
+ parametersEditor.init(null,
+ rData.getParameterList().getInitimeParameters());
+ pack();
+ setLocationRelativeTo(getOwner());
+ } else {
+ // dialog already populated
+ }
//default case when the dialog just gets closed
userCanceled = true;
//show the dialog
setVisible(true);
- //release resources
- dispose();
- if(userCanceled) return;
- else{
+ if(userCanceled){
+ //release resources
+ dispose();
+ return;
+ } else {
Runnable runnable = new Runnable(){
public void run(){
//create the new resource
@@ -211,7 +216,7 @@
if(pListener != null){
pListener.progressChanged(0);
}
-
+ boolean success = true;
try {
long startTime = System.currentTimeMillis();
FeatureMap features = Factory.newFeatureMap();
@@ -226,6 +231,7 @@
(double)(endTime - startTime) / 1000) + " seconds");
if(pListener != null) pListener.processFinished();
} catch(ResourceInstantiationException rie){
+ success = false;
JOptionPane.showMessageDialog(getOwner(),
"Resource could not be created!\n" +
rie.toString(),
@@ -237,6 +243,7 @@
"!");
if(pListener != null) pListener.processFinished();
}catch(Throwable thr){
+ success = false;
JOptionPane.showMessageDialog(getOwner(),
"Unhandled error!\n" +
thr.toString(),
@@ -247,6 +254,15 @@
nameField.getText() +
"!");
if(pListener != null) pListener.processFinished();
+ } finally {
+ if(!success) {
+ // re-show the dialog, to allow the suer to correct the entry
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ show(null);
+ }
+ });
+ }
}
}//public void run()
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs