@@ -0,0 +1,2145 @@
+/*%0A * Copyright 2003-2005 Bas Leijdekkers%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.siyeh.ig.fixes;%0A%0Aimport com.siyeh.ig.InspectionGadgetsFix;%0Aimport com.siyeh.InspectionGadgetsBundle;%0Aimport com.intellij.openapi.project.Project;%0Aimport com.intellij.codeInspection.ProblemDescriptor;%0Aimport com.intellij.util.IncorrectOperationException;%0Aimport com.intellij.psi.*;%0Aimport com.intellij.psi.util.PsiTreeUtil;%0Aimport org.jetbrains.annotations.NonNls;%0A%0Apublic class DeleteUnnecessaryStatementFix extends InspectionGadgetsFix %7B%0A%0A    private final String name;%0A%0A    public DeleteUnnecessaryStatementFix(@NonNls String name) %7B%0A        this.name = name;%0A    %7D%0A%0A    public String getName() %7B%0A        return InspectionGadgetsBundle.message(%0A                %22smth.unnecessary.remove.quickfix%22, name);%0A    %7D%0A%0A    protected void doFix(Project project, ProblemDescriptor descriptor)%0A            throws IncorrectOperationException %7B%0A        final PsiElement keywordElement = descriptor.getPsiElement();%0A        final PsiStatement statement = PsiTreeUtil.getParentOfType(keywordElement,%0A                PsiStatement.class);%0A        if (statement == null) %7B%0A            return;%0A        %7D%0A        final PsiElement parent = statement.getParent();%0A        if (parent instanceof PsiIfStatement %7C%7C%0A                parent instanceof PsiWhileStatement %7C%7C%0A                parent instanceof PsiDoWhileStatement %7C%7C%0A                parent instanceof PsiForeachStatement %7C%7C%0A                parent instanceof PsiForStatement) %7B%0A            replaceStatement(statement, %22%7B%7D%22);%0A        %7D else %7B%0A            deleteElement(statement);%0A        %7D%0A    %7D%0A%7D

fix for IDEADEV-3590