01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards.toc;
11:
12: import java.lang.reflect.InvocationTargetException;
13:
14: import org.eclipse.jface.operation.IRunnableWithProgress;
15: import org.eclipse.jface.viewers.IStructuredSelection;
16: import org.eclipse.jface.wizard.Wizard;
17: import org.eclipse.pde.core.IModel;
18: import org.eclipse.pde.internal.ui.PDEPlugin;
19: import org.eclipse.pde.internal.ui.PDEPluginImages;
20: import org.eclipse.pde.internal.ui.PDEUIMessages;
21: import org.eclipse.ui.INewWizard;
22: import org.eclipse.ui.IWorkbench;
23:
24: /**
25: * NewRegisterCSWizard
26: *
27: */
28: public class RegisterTocWizard extends Wizard implements INewWizard {
29:
30: private RegisterTocWizardPage fMainPage;
31:
32: private IModel fModel;
33:
34: /**
35: *
36: */
37: public RegisterTocWizard(IModel model) {
38: fModel = model;
39: }
40:
41: /* (non-Javadoc)
42: * @see org.eclipse.jface.wizard.Wizard#addPages()
43: */
44: public void addPages() {
45: fMainPage = new RegisterTocWizardPage(fModel);
46: addPage(fMainPage);
47: }
48:
49: /* (non-Javadoc)
50: * @see org.eclipse.jface.wizard.Wizard#performFinish()
51: */
52: public boolean performFinish() {
53: try {
54: getContainer().run(false, true, getOperation());
55: } catch (InvocationTargetException e) {
56: PDEPlugin.logException(e);
57: return false;
58: } catch (InterruptedException e) {
59: return false;
60: }
61: return true;
62: }
63:
64: /**
65: * @return
66: */
67: private IRunnableWithProgress getOperation() {
68: return new RegisterTocOperation(fMainPage, getShell());
69: }
70:
71: /* (non-Javadoc)
72: * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
73: */
74: public void init(IWorkbench workbench,
75: IStructuredSelection selection) {
76: setWindowTitle(PDEUIMessages.RegisterTocWizard_registerTOC);
77: // TODO: MP: LOW: TOC: New register table of contents wizard image
78: setDefaultPageImageDescriptor(PDEPluginImages.DESC_CHEATSHEET_WIZ);
79: setNeedsProgressMonitor(true);
80: }
81:
82: }
|