From b5c1c36f1b49a3d6e879d4b53ec9775acf1a627e Mon Sep 17 00:00:00 2001 From: Stephan Preibisch Date: Tue, 1 Oct 2024 09:39:40 -0400 Subject: [PATCH] fix "Define new dataset" button --- .../queryXML/GenericLoadParseQueryXML.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/queryXML/GenericLoadParseQueryXML.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/queryXML/GenericLoadParseQueryXML.java index 298f584c..339a62a5 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/queryXML/GenericLoadParseQueryXML.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/queryXML/GenericLoadParseQueryXML.java @@ -260,8 +260,6 @@ public boolean queryXML( tryParsing( new URI( defaultXMLURI ), false ); } catch (URISyntaxException e) {} - final GenericDialogPlus gd; - if ( additionalTitle != null && additionalTitle.length() > 0 ) gd = new GenericDialogPlus( "Select dataset for " + additionalTitle ); else @@ -288,19 +286,33 @@ public boolean queryXML( gd.addChoice( query + "_" + attribute, choices, choices[ defaultChoice ] ); } - this.gd = gd; + if ( !PluginHelper.isHeadless() ) + addListeners( gd, (TextField)gd.getStringFields().firstElement(), l1, l2 ); + + if ( buttonText != null && listener != null ) + { + for ( int i = 0; i < buttonText.size(); ++i ) + { + gd.addMessage( "", GUIHelper.smallStatusFont ); + gd.addButton( buttonText.get( i ), listener.get( i ) ); + + try + { + if ( buttonText.get( i ).equals( "Define a new dataset" ) ) + defineNewDataset = ((Button)gd.getComponent( gd.getComponentCount() - 1 )); + } + catch (Exception e) { defineNewDataset = null; } + } + } gd.addMessage( "" ); GUIHelper.addCredits( gd ); - if ( !PluginHelper.isHeadless() ) - addListeners( gd, (TextField)gd.getStringFields().firstElement(), l1, l2 ); - gd.showDialog(); - + if ( gd.wasCanceled() ) return false; - + String xmlURI = defaultXMLURI = gd.getNextString(); // try to parse the file anyways