2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 package org
.jetbrains
.idea
.maven
.wizards
;
23 import com
.intellij
.ide
.util
.projectWizard
.WizardContext
;
24 import com
.intellij
.openapi
.vfs
.VirtualFile
;
25 import com
.intellij
.projectImport
.ProjectOpenProcessorBase
;
26 import org
.jetbrains
.annotations
.Nullable
;
27 import org
.jetbrains
.idea
.maven
.project
.MavenProject
;
28 import org
.jetbrains
.idea
.maven
.utils
.MavenConstants
;
30 import java
.util
.ArrayList
;
31 import java
.util
.Arrays
;
32 import java
.util
.List
;
34 public class MavenProjectOpenProcessor
extends ProjectOpenProcessorBase
{
35 public MavenProjectOpenProcessor(MavenProjectBuilder builder
) {
39 public MavenProjectBuilder
getBuilder() {
40 return (MavenProjectBuilder
)super.getBuilder();
44 public String
[] getSupportedExtensions() {
45 return new String
[]{MavenConstants
.POM_XML
};
48 public boolean doQuickImport(VirtualFile file
, WizardContext wizardContext
) {
49 getBuilder().setFiles(Arrays
.asList(file
));
51 if (!getBuilder().setSelectedProfiles(new ArrayList
<String
>())) return false;
53 List
<MavenProject
> projects
= getBuilder().getList();
54 if (projects
.size() != 1) return false;
56 getBuilder().setList(projects
);
57 wizardContext
.setProjectName(getBuilder().getSuggestedProjectName());