|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.cpp.internal.pi.button.ui; |
|
19 |
|
20 import org.eclipse.jface.viewers.IStructuredSelection; |
|
21 import org.eclipse.jface.wizard.IWizardPage; |
|
22 import org.eclipse.jface.wizard.Wizard; |
|
23 import org.eclipse.ui.IImportWizard; |
|
24 import org.eclipse.ui.IWorkbench; |
|
25 |
|
26 import com.nokia.carbide.cpp.pi.button.BupEventMapManager; |
|
27 |
|
28 |
|
29 public class ImportBupMapWizard extends Wizard implements IImportWizard { |
|
30 |
|
31 private ImportBupMapGetXmlTask importPage; |
|
32 private ImportBupMapShowOverLapTask overlapPage; |
|
33 private boolean allowFinish = false; |
|
34 |
|
35 public ImportBupMapWizard() { |
|
36 setWindowTitle(Messages.getString("ImportBupMapWizard.0")); //$NON-NLS-1$ |
|
37 } |
|
38 |
|
39 /* (non-Javadoc) |
|
40 * @see org.eclipse.jface.wizard.Wizard#addPages() |
|
41 */ |
|
42 public void addPages() { |
|
43 addPage(importPage = new ImportBupMapGetXmlTask()); |
|
44 addPage(overlapPage = new ImportBupMapShowOverLapTask()); |
|
45 } |
|
46 |
|
47 /* (non-Javadoc) |
|
48 * @see org.eclipse.jface.wizard.Wizard#performFinish() |
|
49 */ |
|
50 @Override |
|
51 public boolean performFinish() { |
|
52 java.io.File file = new java.io.File(importPage.getxImportXml()); |
|
53 BupEventMapManager.getInstance().importMergeToWorkspace(file.toURI()); |
|
54 return true; |
|
55 } |
|
56 |
|
57 /* (non-Javadoc) |
|
58 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection) |
|
59 */ |
|
60 public void init(IWorkbench arg0, IStructuredSelection arg1) { |
|
61 } |
|
62 |
|
63 public void setAllowFinish(boolean cond) { |
|
64 allowFinish = cond; |
|
65 } |
|
66 |
|
67 public boolean canFinish() { |
|
68 return allowFinish; |
|
69 } |
|
70 |
|
71 public IWizardPage getNextPage (IWizardPage page) { |
|
72 String [] overlaps = importPage.getOverLapList(); |
|
73 if (page == importPage ) { |
|
74 overlapPage.setOverLapList(overlaps); |
|
75 if (overlaps.length > 0) { |
|
76 return overlapPage; |
|
77 } |
|
78 else { |
|
79 return overlapPage.getNextPage(); |
|
80 } |
|
81 } |
|
82 return super.getNextPage(page); |
|
83 } |
|
84 |
|
85 } |