Package org.mevenide.idea.synchronize

Source Code of org.mevenide.idea.synchronize.AbstractFixAction

package org.mevenide.idea.synchronize;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import javax.swing.*;
import org.mevenide.idea.util.actions.AbstractAnAction;

/**
* @author Arik
*/
public abstract class AbstractFixAction<ProblemType extends ProblemInfo> extends AbstractAnAction {
    protected final ProblemType problem;

    protected AbstractFixAction(final ProblemType pProblem) {
        problem = pProblem;
    }

    protected AbstractFixAction(final String pText, final ProblemType pProblem) {
        super(pText);
        problem = pProblem;
    }

    protected AbstractFixAction(final String pText,
                                final String pDescription,
                                final Icon pIcon,
                                final ProblemType pProblem) {
        super(pText, pDescription, pIcon);
        problem = pProblem;
    }

    @Override
    public void update(final AnActionEvent pEvent) {
        if (pEvent == null)
            return;

        final Presentation p = pEvent.getPresentation();
        if (p == null)
            return;

        p.setEnabled(problem.isValid());
    }
}
TOP

Related Classes of org.mevenide.idea.synchronize.AbstractFixAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.