// Copyright 2015 ThoughtWorks, Inc. // This file is part of getgauge/Intellij-plugin. // getgauge/Intellij-plugin is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // getgauge/Intellij-plugin is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with getgauge/Intellij-plugin. If not, see <http://www.gnu.org/licenses/>. package com.thoughtworks.gauge.module; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleConfigurationEditor; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.roots.ui.configuration.DefaultModuleConfigurationEditorFactory; import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider; import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState; import java.util.ArrayList; import java.util.List; public class GaugeModuleConfigurationProvider implements ModuleConfigurationEditorProvider { @Override public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) { final Module module = state.getRootModel().getModule(); final ModuleType moduleType = ModuleType.get(module); if (!(moduleType instanceof GaugeModuleType)) { return ModuleConfigurationEditor.EMPTY; } final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance(); List<ModuleConfigurationEditor> editors = new ArrayList<>(); editors.add(editorFactory.createModuleContentRootsEditor(state)); editors.add(editorFactory.createOutputEditor(state)); editors.add(editorFactory.createClasspathEditor(state)); return editors.toArray(new ModuleConfigurationEditor[editors.size()]); } }