use of ch.acanda.eclipse.pmd.repository.ProjectModelRepository in project eclipse-pmd by acanda.
the class PMDPlugin method start.
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void start(final BundleContext context) throws Exception {
super.start(context);
plugin = this;
V07ToV08Converter.moveSettings(getPreferenceStore(), new ProjectModelRepository());
initWorkspaceModel();
initPMD();
}
use of ch.acanda.eclipse.pmd.repository.ProjectModelRepository in project eclipse-pmd by acanda.
the class PMDPlugin method initWorkspaceModel.
private void initWorkspaceModel() {
workspaceModel = new WorkspaceModel();
final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final ProjectModelRepository projectModelRepository = new ProjectModelRepository();
for (final IProject project : projects) {
final Optional<ProjectModel> model = projectModelRepository.load(project.getName());
if (model.isPresent()) {
workspaceModel.add(model.get());
} else {
workspaceModel.add(new ProjectModel(project.getName()));
}
}
final IResourceChangeListener workspaceChangeListener = new WorkspaceChangeListener(workspaceModel, projectModelRepository);
ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceChangeListener, IResourceChangeEvent.POST_CHANGE);
}
use of ch.acanda.eclipse.pmd.repository.ProjectModelRepository in project eclipse-pmd by acanda.
the class PMDPropertyPageController method save.
public void save() {
projectModel.setPMDEnabled(model.isPMDEnabled());
projectModel.setRuleSets(toDomainModels(model.getActiveRuleSets()));
final ProjectModelRepository projectModelRepository = new ProjectModelRepository();
projectModelRepository.save(projectModel);
try {
if (model.isPMDEnabled()) {
PMDNature.addTo(project);
} else {
PMDNature.removeFrom(project);
}
} catch (final CoreException e) {
PMDPlugin.getDefault().error("Cannot change PMD nature of project " + project.getName(), e);
}
}
Aggregations