Skip to content

Commit

Permalink
fix "Define new dataset" button
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed Oct 1, 2024
1 parent 1d9c91f commit b5c1c36
Showing 1 changed file with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b5c1c36

Please sign in to comment.