This method is supposed to merge two the definitions of two entries for a single in a glossary. It creates an instance of the GlossaryEntryMergeUI class (extension of JFrame), which walks the user through the merging process. The user clicks a button to submit and the window closes. The merge method extracts the merged definitions and returns the combined glossary entry.
What is the best way to make the merge method wait for response from the MergeUI? I tried using InvokeAndWait, but I couldn't figure out how to make it work.
public GlossaryEntry merge(GlossaryEntry otherEntry){
//First, merge the definitions
GlossaryEntryMergeUI thisMerge = new GlossaryEntryMergeUI(this,otherEntry,mergeSignal);
thisMerge.setVisible(true);
thisMerge.setAlwaysOnTop(true);
GlossaryEntry combined = new GlossaryEntry(word);
combined.addDefinitions(thisMerge.getDefinitions());
return combined;
}