Search in sources :

Example 1 with AddRuleSetConfigurationWizard

use of ch.acanda.eclipse.pmd.wizard.AddRuleSetConfigurationWizard in project eclipse-pmd by acanda.

the class PMDPropertyPageController method addRuleSetConfiguration.

public void addRuleSetConfiguration(final Shell shell) {
    final AddRuleSetConfigurationWizard wizard = new AddRuleSetConfigurationWizard(project);
    final WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.setPageSize(300, SWT.DEFAULT);
    final int result = dialog.open();
    if (result == Window.OK && wizard.getRuleSetModel() != null) {
        final RuleSetViewModel viewModel = toViewModel(wizard.getRuleSetModel(), project);
        model.addRuleSet(viewModel);
        final HashSet<RuleSetViewModel> activeConfigs = new HashSet<>(model.getActiveRuleSets());
        activeConfigs.add(viewModel);
        model.setActiveRuleSets(activeConfigs);
    }
}
Also used : RuleSetViewModel(ch.acanda.eclipse.pmd.properties.PMDPropertyPageViewModel.RuleSetViewModel) AddRuleSetConfigurationWizard(ch.acanda.eclipse.pmd.wizard.AddRuleSetConfigurationWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) HashSet(java.util.HashSet)

Aggregations

RuleSetViewModel (ch.acanda.eclipse.pmd.properties.PMDPropertyPageViewModel.RuleSetViewModel)1 AddRuleSetConfigurationWizard (ch.acanda.eclipse.pmd.wizard.AddRuleSetConfigurationWizard)1 HashSet (java.util.HashSet)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1