Search in sources :

Example 1 with PriorityFilterAction

use of net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction in project pmd-eclipse-plugin by pmd.

the class ViolationOverviewMenuManager method setupActions.

/**
 * Setup the Actions for the ActionBars
 */
public void setupActions() {
    RulePriority[] priorities = UISettings.currentPriorities(true);
    priorityActions = new PriorityFilterAction[priorities.length];
    // create the Actions for the PriorityFilter
    for (int i = 0; i < priorities.length; i++) {
        // NOPMD by Herlin on 09/10/06 15:02
        priorityActions[i] = new PriorityFilterAction(priorities[i], overview);
        priorityActions[i].setChecked(PriorityUtil.isPriorityActive(priorities[i]));
    }
}
Also used : PriorityFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction) RulePriority(net.sourceforge.pmd.RulePriority)

Example 2 with PriorityFilterAction

use of net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction in project pmd-eclipse-plugin by pmd.

the class ViolationOutline method addFilterControls.

/**
 * Creates a DropDownMenu for the view
 */
private void addFilterControls() {
    IMenuManager manager = getViewSite().getActionBars().getMenuManager();
    List<Integer> filterList = priorityFilter.getPriorityFilterList();
    // we add the PriorityFilter-Actions to this Menu
    RulePriority[] priorities = UISettings.currentPriorities(true);
    for (RulePriority priority : priorities) {
        Action filterAction = new PriorityFilterAction(priority, this);
        if (filterList.contains(priority.getPriority())) {
            filterAction.setChecked(true);
        }
        manager.add(filterAction);
    }
}
Also used : DisableRuleAction(net.sourceforge.pmd.eclipse.ui.views.actions.DisableRuleAction) ReviewAction(net.sourceforge.pmd.eclipse.ui.views.actions.ReviewAction) PriorityFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction) Action(org.eclipse.jface.action.Action) RemoveViolationAction(net.sourceforge.pmd.eclipse.ui.views.actions.RemoveViolationAction) ShowRuleAction(net.sourceforge.pmd.eclipse.ui.views.actions.ShowRuleAction) QuickFixAction(net.sourceforge.pmd.eclipse.ui.views.actions.QuickFixAction) PriorityFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction) IMenuManager(org.eclipse.jface.action.IMenuManager) RulePriority(net.sourceforge.pmd.RulePriority)

Example 3 with PriorityFilterAction

use of net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction in project pmd-eclipse-plugin by pmd.

the class ViolationOverviewMenuManager method createContextMenu.

/**
 * Creates the Context Menu
 */
public void createContextMenu() {
    MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            MenuManager submenuManager;
            // one SubMenu for filtering Projects
            submenuManager = new MenuManager(getString(StringKeys.VIEW_MENU_RESOURCE_FILTER));
            createProjectFilterMenu(submenuManager);
            manager.add(submenuManager);
            // ... another one for filtering Priorities
            submenuManager = new MenuManager(getString(StringKeys.VIEW_MENU_PRIORITY_FILTER));
            for (PriorityFilterAction priorityAction : priorityActions) {
                submenuManager.add(priorityAction);
            }
            manager.add(submenuManager);
            // ... another one for showing the presentation types
            submenuManager = new MenuManager(getString(StringKeys.VIEW_MENU_PRESENTATION_TYPE));
            createShowTypeSubmenu(submenuManager);
            manager.add(submenuManager);
            // additions Action: Clear PMD Violations
            manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
            manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end"));
        }
    });
    Tree tree = overview.getViewer().getTree();
    tree.setMenu(manager.createContextMenu(tree));
    overview.getSite().registerContextMenu(manager, overview.getViewer());
}
Also used : PriorityFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Tree(org.eclipse.swt.widgets.Tree) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuListener(org.eclipse.jface.action.IMenuListener) Separator(org.eclipse.jface.action.Separator)

Example 4 with PriorityFilterAction

use of net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction in project pmd-eclipse-plugin by pmd.

the class ViolationOverviewMenuManager method createActionBars.

/**
 * Creates the ActionBars
 */
public void createActionBars(IToolBarManager manager) {
    // Action for calculating the #violations/loc
    final Action calculateStats = new CalculateStatisticsAction(overview);
    manager.add(calculateStats);
    manager.add(new Separator());
    // the PriorityFilter-Actions
    for (PriorityFilterAction priorityAction : priorityActions) {
        manager.add(priorityAction);
    }
    manager.add(new Separator());
    Action collapseAllAction = new CollapseAllAction(overview.getViewer());
    manager.add(collapseAllAction);
}
Also used : CalculateStatisticsAction(net.sourceforge.pmd.eclipse.ui.views.actions.CalculateStatisticsAction) PriorityFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction) Action(org.eclipse.jface.action.Action) ProjectFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.ProjectFilterAction) ViolationPresentationTypeAction(net.sourceforge.pmd.eclipse.ui.views.actions.ViolationPresentationTypeAction) CollapseAllAction(net.sourceforge.pmd.eclipse.ui.views.actions.CollapseAllAction) PriorityFilterAction(net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction) CollapseAllAction(net.sourceforge.pmd.eclipse.ui.views.actions.CollapseAllAction) CalculateStatisticsAction(net.sourceforge.pmd.eclipse.ui.views.actions.CalculateStatisticsAction) Separator(org.eclipse.jface.action.Separator)

Aggregations

PriorityFilterAction (net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction)4 RulePriority (net.sourceforge.pmd.RulePriority)2 Action (org.eclipse.jface.action.Action)2 IMenuManager (org.eclipse.jface.action.IMenuManager)2 Separator (org.eclipse.jface.action.Separator)2 CalculateStatisticsAction (net.sourceforge.pmd.eclipse.ui.views.actions.CalculateStatisticsAction)1 CollapseAllAction (net.sourceforge.pmd.eclipse.ui.views.actions.CollapseAllAction)1 DisableRuleAction (net.sourceforge.pmd.eclipse.ui.views.actions.DisableRuleAction)1 ProjectFilterAction (net.sourceforge.pmd.eclipse.ui.views.actions.ProjectFilterAction)1 QuickFixAction (net.sourceforge.pmd.eclipse.ui.views.actions.QuickFixAction)1 RemoveViolationAction (net.sourceforge.pmd.eclipse.ui.views.actions.RemoveViolationAction)1 ReviewAction (net.sourceforge.pmd.eclipse.ui.views.actions.ReviewAction)1 ShowRuleAction (net.sourceforge.pmd.eclipse.ui.views.actions.ShowRuleAction)1 ViolationPresentationTypeAction (net.sourceforge.pmd.eclipse.ui.views.actions.ViolationPresentationTypeAction)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Tree (org.eclipse.swt.widgets.Tree)1