blob: 832d4d504295c14e6b563641a9799a16af32a71e [file] [log] [blame]
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.config;
import com.intellij.framework.FrameworkTypeEx;
import com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable;
import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportModel;
import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
import org.jetbrains.annotations.NotNull;
/**
* @author peter
*/
public class GroovyFrameworkSupportProvider extends FrameworkSupportInModuleProvider {
@NotNull
@Override
public FrameworkTypeEx getFrameworkType() {
return FrameworkTypeEx.EP_NAME.findExtension(GroovyFrameworkType.class);
}
@Override
public boolean isEnabledForModuleBuilder(@NotNull ModuleBuilder builder) {
return super.isEnabledForModuleBuilder(builder) && !(builder instanceof GroovyAwareModuleBuilder);
}
@Override
public boolean isSupportAlreadyAdded(@NotNull Module module, @NotNull FacetsProvider facetsProvider) {
final String version = GroovyConfigUtils.getInstance().getSDKVersion(module);
return version != null;
}
@Override
@NotNull
public FrameworkSupportInModuleConfigurable createConfigurable(@NotNull final FrameworkSupportModel model) {
return new GroovySupportConfigurable();
}
@Override
public boolean isEnabledForModuleType(@NotNull ModuleType moduleType) {
return GroovyFacetUtil.isAcceptableModuleType(moduleType);
}
}