blob: 33eb20caa5dd3d2fe875284d404af1fee1f686e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*******************************************************************************
* Copyright (c) 2008-2010 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.core.ui.internal.wizards;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.IMavenDiscovery;
import org.eclipse.m2e.core.project.ProjectImportConfiguration;
import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
@SuppressWarnings("restriction")
public abstract class AbstractMavenProjectWizard extends Wizard {
protected IStructuredSelection selection;
protected ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration();
protected List<IWorkingSet> workingSets = new ArrayList<IWorkingSet>();
private IMavenDiscovery discovery;
private IMavenDiscoveryUI pageFactory;
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
this.importConfiguration = new ProjectImportConfiguration();
this.discovery = M2EUIPluginActivator.getDefault().getMavenDiscovery();
this.pageFactory = M2EUIPluginActivator.getDefault().getImportWizardPageFactory();
IWorkingSet workingSet = SelectionUtil.getSelectedWorkingSet(selection);
if(workingSet != null) {
this.workingSets.add(workingSet);
}
}
@Override
public void dispose() {
M2EUIPluginActivator.getDefault().ungetMavenDiscovery(discovery);
super.dispose();
}
public ProjectImportConfiguration getProjectImportConfiguration() {
return importConfiguration;
}
public IMavenDiscovery getDiscovery() {
return discovery;
}
public IMavenDiscoveryUI getPageFactory() {
return pageFactory;
}
}
|