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.
16 package org
.jetbrains
.idea
.maven
.dom
;
18 import com
.intellij
.javaee
.ExternalResourceManager
;
19 import com
.intellij
.javaee
.ResourceRegistrar
;
20 import com
.intellij
.javaee
.StandardResourceProvider
;
21 import com
.intellij
.openapi
.vfs
.VfsUtil
;
22 import com
.intellij
.openapi
.vfs
.VirtualFile
;
23 import org
.jetbrains
.annotations
.NotNull
;
25 public class MavenSchemaProvider
implements StandardResourceProvider
{
26 public static final String MAVEN_PROJECT_SCHEMA_URL
= "http://maven.apache.org/xsd/maven-4.0.0.xsd";
27 public static final String MAVEN_PROFILES_SCHEMA_URL
= "http://maven.apache.org/xsd/profiles-1.0.0.xsd";
28 public static final String MAVEN_SETTINGS_SCHEMA_URL
= "http://maven.apache.org/xsd/settings-1.0.0.xsd";
30 public void registerResources(ResourceRegistrar registrar
) {
31 registrar
.addStdResource("http://maven.apache.org/maven-v4_0_0.xsd", "maven-4.0.0.xsd", getClass());
32 registrar
.addStdResource(MAVEN_PROJECT_SCHEMA_URL
, "maven-4.0.0.xsd", getClass());
34 registrar
.addStdResource(MAVEN_PROFILES_SCHEMA_URL
, "profiles-1.0.0.xsd", getClass());
35 registrar
.addStdResource(MAVEN_SETTINGS_SCHEMA_URL
, "settings-1.0.0.xsd", getClass());
39 public static VirtualFile
getSchemaFile(@NotNull String url
) {
40 return VfsUtil
.findRelativeFile(ExternalResourceManager
.getInstance().getResourceLocation(url
), null);