--- /dev/null
+/*
+ * Copyright (c) 2002 Team in a Box Ltd. All rights reserved. This file is made available under the terms and conditions of the
+ * Common Public License v 1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v1.0.html
+ *
+ * Contributors: Team in a Box Ltd http://www.teaminabox.co.uk/
+ */
+
+package net.sourceforge.phpeclipse.wiki.export.pdf;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+
+import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+public final class WikiPDFExportWizard extends Wizard implements INewWizard {
+ static final QualifiedName DIRECTORY_QUALIFIED_NAME = new QualifiedName(WikiEditorPlugin.PLUGIN_ID, "exportDirectory");
+
+ private WikiPDFExportWizardPage page;
+
+ private IStructuredSelection selection;
+
+ public WikiPDFExportWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ }
+
+ public void addPages() {
+ page = new WikiPDFExportWizardPage(selection);
+ addPage(page);
+ }
+
+ public boolean performFinish() {
+ return page.finish();
+ }
+
+ private boolean runOperationForContainer(IRunnableWithProgress op) {
+ try {
+ getContainer().run(true, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ WikiEditorPlugin.getDefault().log("", e);
+ MessageDialog.openError(getShell(), "Error", e.getTargetException().getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ private void persistExportProperties() {
+ IProject project = page.getFolder().getProject();
+ try {
+ project.setPersistentProperty(WikiPDFExportWizard.DIRECTORY_QUALIFIED_NAME, new File(page.getExportDirectoryPath())
+ .getAbsolutePath());
+ } catch (CoreException cex) {
+ noteException(cex);
+ }
+ }
+
+ private void noteException(CoreException cex) {
+ WikiEditorPlugin.getDefault().log("Export Error", cex);
+ throw new RuntimeException("An error occurred. Please see the log for details.");
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ }
+}
\ No newline at end of file