Post

2 followers Follow
0
Avatar

performOperation and getOptions don't actually pass selected documents

In my DocumentOperation subclass, neither the performOperation nor the getOptions method pass in the user-selected documents, as stated in the API docs. Do I misunderstand something? DocumentUtilities.getSelectedDocuments DOES provide the selected documents.

See here for the code:

https://github.com/naturalis/sd_java__geneious_plugin/blob/1af31cfbc03a8f63befaf210c6aae86940014d36/importers/src/main/java/nl/naturalis/geneious/smpl/SampleSheetDocumentOperation.java 

Informatiemanagement

Please sign in to leave a comment.

2 comments

0
Avatar

It looks like it's because you return an empty array from getSelectionSignatures. The javadoc states:

"If an operation accepts no documents as input, it should return an empty array and the operation will always be enabled but won't be passed any documents as input."

If you want to accept any selection of documents rather than no documents you should have the following:

public DocumentSelectionSignature[] getSelectionSignatures() {
  return new DocumentSelectionSignature[] {
    new DocumentSelectionSignature(PluginDocument.class, 1, Integer.MAX_VALUE)
  };
}
Richard Moir 0 votes
Comment actions Permalink