Revision 707b6237
Added by Niels Hoffmann over 12 years ago
eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java | ||
---|---|---|
15 | 15 |
import org.eclipse.core.commands.AbstractHandler; |
16 | 16 |
import org.eclipse.core.commands.ExecutionEvent; |
17 | 17 |
import org.eclipse.core.commands.ExecutionException; |
18 |
import org.eclipse.core.runtime.Status; |
|
19 | 18 |
import org.eclipse.jface.wizard.WizardDialog; |
20 | 19 |
import org.eclipse.ui.IEditorInput; |
21 | 20 |
import org.eclipse.ui.IEditorPart; |
... | ... | |
27 | 26 |
import eu.etaxonomy.cdm.print.out.pdf.PdfOutputModule; |
28 | 27 |
import eu.etaxonomy.cdm.print.out.xml.XMLOutputModule; |
29 | 28 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
29 |
import eu.etaxonomy.taxeditor.printpublisher.PrintUtil; |
|
30 | 30 |
import eu.etaxonomy.taxeditor.printpublisher.wizard.DirectPublishingWizard; |
31 | 31 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
32 | 32 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
... | ... | |
55 | 55 |
return null; |
56 | 56 |
} |
57 | 57 |
|
58 |
configurator = PublishConfigurator.NewLocalInstance(null);//CdmStore.getCurrentApplicationController());
|
|
58 |
configurator = PublishConfigurator.NewLocalInstance(CdmStore.getCurrentApplicationConfiguration());
|
|
59 | 59 |
|
60 | 60 |
Element taxonNodeElement = getTaxonNodeElement((TaxonEditorInput) input); |
61 | 61 |
configurator.addSelectedTaxonNodeElements(taxonNodeElement); |
62 | 62 |
|
63 | 63 |
configurator.setDoPublishEntireBranches(false); |
64 | 64 |
|
65 |
configurator.addOutputModule(new XMLOutputModule()); |
|
66 | 65 |
configurator.addOutputModule(new PdfOutputModule()); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
// while testing |
|
71 |
// configurator.setFeatureTree(UUID.fromString("168df0c6-6429-484c-b26f-ded1f7e44bd9")); |
|
72 |
// configurator.setExportFolder(new File("/Users/n.hoffmann/tmp/")); |
|
73 |
// |
|
74 |
// ConversationHolder conversation = CdmStore.createConversation(); |
|
75 |
// conversation.close(); |
|
76 |
//// try{ |
|
77 |
// Publisher.publish(configurator); |
|
78 |
//// conversation.commit(); |
|
79 |
//// }finally{ |
|
80 |
//// conversation.close(); |
|
81 |
//// } |
|
82 |
|
|
83 |
|
|
84 |
// enable this when not testing |
|
66 |
configurator.addOutputModule(new XMLOutputModule()); |
|
67 |
|
|
85 | 68 |
DirectPublishingWizard wizard = new DirectPublishingWizard(configurator); |
86 | 69 |
WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard); |
87 | 70 |
|
88 |
int result = dialog.open();
|
|
71 |
dialog.open(); |
|
89 | 72 |
|
90 |
if(result == Status.OK || result == Status.CANCEL){ |
|
91 |
return null; |
|
92 |
}else{ |
|
93 |
throw new RuntimeException("An error occurred during print publishing."); |
|
94 |
} |
|
73 |
return null; |
|
95 | 74 |
} |
96 | 75 |
|
97 | 76 |
private Element getTaxonNodeElement(TaxonEditorInput input){ |
Also available in: Unified diff
Merged with trunk