use of name.herlin.command.CommandException in project pmd-eclipse-plugin by pmd.
the class GenerateReportAction method run.
/**
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public final void run(final IAction action) {
LOG.info("Generation Report action requested");
final ISelection sel = targetSelection();
if (sel instanceof IStructuredSelection) {
try {
IProject project = getProject((IStructuredSelection) sel);
if (project != null) {
if (!checkRenderers()) {
return;
}
RenderReportsCmd cmd = new RenderReportsCmd();
cmd.setProject(project);
cmd.setUserInitiated(true);
registerRenderers(cmd);
cmd.performExecute();
}
} catch (CommandException e) {
showErrorById(StringKeys.ERROR_PMD_EXCEPTION, e);
}
}
}
use of name.herlin.command.CommandException in project pmd-eclipse-plugin by pmd.
the class ViolationOverview method deleteMarkers.
private void deleteMarkers(IMarker[] markers) {
if (markers.length > 0) {
DeleteMarkersCommand cmd = new DeleteMarkersCommand();
cmd.setMarkers(markers);
try {
cmd.performExecute();
} catch (CommandException e) {
PMDPlugin.getDefault().showError(getString(StringKeys.ERROR_CORE_EXCEPTION), e.getCause());
}
}
}
use of name.herlin.command.CommandException in project pmd-eclipse-plugin by pmd.
the class DataflowViewPage method refreshDFATable.
/**
* Executes a command to refresh the DFA table. After execution
* {@link #refresh(IResource)} will be called.
*
* @param newResource
* the new resource
*/
public void refreshDFATable(IResource newResource) {
isTableRefreshed = true;
try {
ReviewResourceForRuleCommand cmd = new ReviewResourceForRuleCommand();
DataflowAnomalyAnalysisRule rule = new DataflowAnomalyAnalysisRule();
rule.setUsesDFA();
cmd.setUserInitiated(false);
cmd.setRule(rule);
cmd.setResource(newResource);
cmd.addPropertyListener(this);
cmd.performExecute();
} catch (CommandException e) {
logErrorByKey(StringKeys.ERROR_PMD_EXCEPTION, e);
}
}
use of name.herlin.command.CommandException in project pmd-eclipse-plugin by pmd.
the class UpdateProjectPropertiesCmd method execute.
/**
* @see name.herlin.command.AbstractProcessableCommand#execute()
*/
public void execute() throws CommandException {
try {
final IProjectProperties properties = projectProperties();
properties.setPmdEnabled(pmdEnabled);
properties.setProjectRuleSet(projectRuleSet);
properties.setProjectWorkingSet(projectWorkingSet);
properties.setRuleSetStoredInProject(ruleSetStoredInProject);
properties.setRuleSetFile(ruleSetFile);
properties.setIncludeDerivedFiles(includeDerivedFiles);
properties.setFullBuildEnabled(fullBuildEnabled);
properties.setViolationsAsErrors(violationsAsErrors);
properties.sync();
needRebuild = properties.isNeedRebuild();
ruleSetFileExists = !properties.isRuleSetFileExist();
} catch (PropertiesException e) {
throw new CommandException(e.getMessage(), e);
} finally {
setTerminated(true);
}
}
use of name.herlin.command.CommandException in project pmd-eclipse-plugin by pmd.
the class ReviewResourceAction method run.
/**
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
try {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
setMonitor(monitor);
monitor.beginTask(getString(StringKeys.MONITOR_REVIEW), 5);
ReviewCodeCmd cmd = new ReviewCodeCmd();
cmd.addResource(resource);
cmd.setStepCount(1);
cmd.setTaskMarker(true);
cmd.setUserInitiated(true);
try {
cmd.performExecute();
} catch (CommandException e) {
logErrorByKey(StringKeys.ERROR_CORE_EXCEPTION, e);
}
monitor.done();
}
});
} catch (InvocationTargetException e) {
logErrorByKey(StringKeys.ERROR_INVOCATIONTARGET_EXCEPTION, e);
} catch (InterruptedException e) {
logErrorByKey(StringKeys.ERROR_INTERRUPTED_EXCEPTION, e);
}
}
Aggregations