2 * Copyright 2000-2015 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 com.intellij.openapi.roots;
18 import com.intellij.openapi.extensions.ExtensionPointName;
19 import com.intellij.openapi.module.Module;
20 import com.intellij.openapi.roots.libraries.Library;
21 import org.jetbrains.annotations.NotNull;
22 import org.jetbrains.annotations.Nullable;
23 import org.jetbrains.concurrency.Promise;
25 import java.util.Collection;
28 * Register implementation of this extension to support custom dependency management system for {@link ProjectModelModificationService}.
29 * The default implementation which modify IDEA's project model directly is registered as the last extension so it'll be executed if all other
30 * extensions refuse to handle modification by returning {@code null}.
32 * @see ProjectModelModificationService
36 public abstract class ProjectModelModifier {
37 public static final ExtensionPointName<ProjectModelModifier> EP_NAME = ExtensionPointName.create("com.intellij.projectModelModifier");
40 * Implementation of this method should add dependency from module {@code from} to module {@code to} with scope {@code scope} accordingly
41 * to this dependencies management system. If it takes some time to propagate changes in the external project configuration to IDEA's
42 * project model the method may schedule this work for asynchronous execution and return {@link Promise} instance which will be fulfilled
43 * when the work is done.
44 * @return {@link Promise} instance if dependencies between these modules can be handled by this dependencies management system or
45 * {@code null} otherwise
48 public abstract Promise<Void> addModuleDependency(@NotNull Module from, @NotNull Module to, @NotNull DependencyScope scope);
51 * Implementation of this method should add dependency from modules {@code modules} to an external library with scope {@code scope} accordingly
52 * to this dependencies management system. If it takes some time to propagate changes in the external project configuration to IDEA's
53 * project model the method may schedule this work for asynchronous execution and return {@link Promise} instance which will be fulfilled
54 * when the work is done.
56 * @return {@link Promise} instance if dependencies of these modules can be handled by this dependencies management system or
57 * {@code null} otherwise
60 public abstract Promise<Void> addExternalLibraryDependency(@NotNull Collection<Module> modules,
61 @NotNull ExternalLibraryDescriptor descriptor,
62 @NotNull DependencyScope scope);
65 * Implementation of this method should add dependency from module {@code from} to {@code library} with scope {@code scope} accordingly
66 * to this dependencies management system. If it takes some time to propagate changes in the external project configuration to IDEA's
67 * project model the method may schedule this work for asynchronous execution and return {@link Promise} instance which will be fulfilled
68 * when the work is done.
70 * @return {@link Promise} instance if dependencies between these modules can be handled by this dependencies management system or
71 * {@code null} otherwise
74 public abstract Promise<Void> addLibraryDependency(@NotNull Module from, @NotNull Library library, @NotNull DependencyScope scope);