// Path: src/org/idea/processing/plugin/project_creation/ProcessingModuleType.java
// public class ProcessingModuleType extends ModuleType<ProcessingModuleBuilder> {
//     private static final String id = "org.idea.processing.module";
// 
//     public ProcessingModuleType() {
//         super(id);
//     }
// 
//     public static ProcessingModuleType getInstance() {
//         return (ProcessingModuleType) ModuleTypeManager.getInstance().findByID(id);
//     }
// 
//     @NotNull
//     @Override
//     public ProcessingModuleBuilder createModuleBuilder() {
//         return new ProcessingModuleBuilder();
//     }
// 
//     @NotNull
//     @Override
//     public String getName() {
//         return "Processing Module";
//     }
// 
//     @NotNull
//     @Override
//     public String getDescription() {
//         return "A Processing language module.";
//     }
// 
//     @Override
//     public Icon getBigIcon() {
//         return AllIcons.General.Information;
//     }
// 
//     @Override
//     public Icon getNodeIcon(@Deprecated boolean b) {
//         return AllIcons.General.Information;
//     }
// 
//     @Nullable
//     @Override
//     public ModuleWizardStep modifyProjectTypeStep(@NotNull SettingsStep settingsStep, @NotNull final ModuleBuilder moduleBuilder) {
//         return ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, moduleBuilder,
//                 moduleBuilder::isSuitableSdkType);
//     }
// 
//     @NotNull
//     @Override
//     public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ProcessingModuleBuilder moduleBuilder, @NotNull ModulesProvider modulesProvider) {
//         return super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider);
//     }
// }


import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import com.intellij.codeInsight.intention.HighPriorityAction;
import com.intellij.codeInspection.CleanupLocalInspectionTool;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import org.idea.processing.plugin.project_creation.ProcessingModuleType;
import org.jetbrains.annotations.Nls;
/*
 * Copyright (c) 2017  mistodev
 *
 * This file is part of "Processing IDEA plugin" and 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 2
 * of the License, or (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package org.idea.processing.plugin.intention;



// @TODO Refactor code to reduce duplication.
public class SettingsInvokedInSetupInspection extends LocalInspectionTool implements CleanupLocalInspectionTool {

    private final Collection<String> SETTINGS_METHODS =
            new HashSet<>(Arrays.asList("size", "fullScreen", "pixelDensity", "smooth", "noSmooth"));

    @NotNull
    public String getGroupDisplayName() {
        return "Processing";
    }

    @Nls
    @NotNull
    @Override
    public String getDisplayName() {
        return "Settings methods must be invoked only from 'settings' method";
    }

    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
        Module psiFileModule = ModuleUtil.findModuleForPsiElement(holder.getFile());

// Path: src/org/idea/processing/plugin/project_creation/ProcessingModuleType.java
// public class ProcessingModuleType extends ModuleType<ProcessingModuleBuilder> {
//     private static final String id = "org.idea.processing.module";
// 
//     public ProcessingModuleType() {
//         super(id);
//     }
// 
//     public static ProcessingModuleType getInstance() {
//         return (ProcessingModuleType) ModuleTypeManager.getInstance().findByID(id);
//     }
// 
//     @NotNull
//     @Override
//     public ProcessingModuleBuilder createModuleBuilder() {
//         return new ProcessingModuleBuilder();
//     }
// 
//     @NotNull
//     @Override
//     public String getName() {
//         return "Processing Module";
//     }
// 
//     @NotNull
//     @Override
//     public String getDescription() {
//         return "A Processing language module.";
//     }
// 
//     @Override
//     public Icon getBigIcon() {
//         return AllIcons.General.Information;
//     }
// 
//     @Override
//     public Icon getNodeIcon(@Deprecated boolean b) {
//         return AllIcons.General.Information;
//     }
// 
//     @Nullable
//     @Override
//     public ModuleWizardStep modifyProjectTypeStep(@NotNull SettingsStep settingsStep, @NotNull final ModuleBuilder moduleBuilder) {
//         return ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, moduleBuilder,
//                 moduleBuilder::isSuitableSdkType);
//     }
// 
//     @NotNull
//     @Override
//     public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ProcessingModuleBuilder moduleBuilder, @NotNull ModulesProvider modulesProvider) {
//         return super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider);
//     }
// }


// Path: src/org/idea/processing/plugin/intention/SettingsInvokedInSetupInspection.java
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import com.intellij.codeInsight.intention.HighPriorityAction;
import com.intellij.codeInspection.CleanupLocalInspectionTool;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import org.idea.processing.plugin.project_creation.ProcessingModuleType;
import org.jetbrains.annotations.Nls;

/*
 * Copyright (c) 2017  mistodev
 *
 * This file is part of "Processing IDEA plugin" and 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 2
 * of the License, or (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package org.idea.processing.plugin.intention;



// @TODO Refactor code to reduce duplication.
public class SettingsInvokedInSetupInspection extends LocalInspectionTool implements CleanupLocalInspectionTool {

    private final Collection<String> SETTINGS_METHODS =
            new HashSet<>(Arrays.asList("size", "fullScreen", "pixelDensity", "smooth", "noSmooth"));

    @NotNull
    public String getGroupDisplayName() {
        return "Processing";
    }

    @Nls
    @NotNull
    @Override
    public String getDisplayName() {
        return "Settings methods must be invoked only from 'settings' method";
    }

    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
        Module psiFileModule = ModuleUtil.findModuleForPsiElement(holder.getFile());

        if (psiFileModule != null && ModuleUtil.getModuleType(psiFileModule) != ProcessingModuleType.getInstance()) {