01: package net.refractions.udig.project.ui.internal;
02:
03: import java.util.List;
04:
05: import net.refractions.udig.project.internal.Layer;
06: import net.refractions.udig.project.internal.Map;
07:
08: import org.eclipse.jface.viewers.IStructuredSelection;
09: import org.eclipse.jface.wizard.Wizard;
10: import org.eclipse.swt.widgets.Display;
11: import org.eclipse.ui.INewWizard;
12: import org.eclipse.ui.IWorkbench;
13:
14: /**
15: * @author Richard Gould
16: */
17: public class NewLayerWizard extends Wizard implements INewWizard {
18:
19: SelectMapPage selectMapPage;
20: SelectLayersPage selectLayersPage;
21: MapStylePage selectStylePage;
22:
23: /**
24: * @see org.eclipse.jface.wizard.IWizard#addPages()
25: */
26: public void addPages() {
27: selectMapPage = new SelectMapPage();
28: selectLayersPage = new SelectLayersPage();
29:
30: addPage(selectMapPage);
31: addPage(selectLayersPage);
32: }
33:
34: /**
35: * @see org.eclipse.jface.wizard.IWizard#canFinish()
36: */
37: public boolean canFinish() {
38: return selectMapPage.isPageComplete()
39: && selectLayersPage.isPageComplete();
40: }
41:
42: /**
43: * @see org.eclipse.jface.wizard.IWizard#performFinish()
44: */
45: public boolean performFinish() {
46: Display.getDefault().asyncExec(new Runnable() {
47: public void run() {
48: Map map = selectMapPage.selectedMap;
49: List layers = selectLayersPage.getLayerRefs();
50:
51: for (int i = 0; i < layers.size(); i++) {
52: Layer layer = (Layer) layers.get(i);
53: map.getContextModel().getLayers().add(layer);
54: }
55: }
56: });
57: return true;
58: }
59:
60: /**
61: * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
62: * org.eclipse.jface.viewers.IStructuredSelection)
63: */
64: public void init(IWorkbench workbench,
65: IStructuredSelection selection) {
66: // TODO Auto-generated method stub
67: }
68: }
|