use of com.devonfw.cobigen.eclipse.common.exceptions.CobiGenEclipseRuntimeException in project cobigen by devonfw.
the class CobiGenWrapper method setInputs.
/**
* Sets the given input objects for generation
*
* @param inputs input objects for generation
*/
private void setInputs(List<Object> inputs) {
this.inputs = inputs;
LOG.info("Set new generator inputs: {}", inputs);
this.matchingTemplates = Lists.newLinkedList();
LOG.debug("Calculating matching templates...");
PlatformUIUtil.getWorkbench().getDisplay().syncExec(() -> {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell());
AnalyzeInputJob job = new AnalyzeInputJob(this.cobiGen, inputs);
try {
dialog.run(true, false, job);
} catch (InvocationTargetException e) {
LOG.error("An internal error occured while invoking input analyzer job.", e);
throw new CobiGenEclipseRuntimeException("An internal error occured while invoking input analyzer job", e);
} catch (InterruptedException e) {
LOG.warn("The working thread doing the input analyzer job has been interrupted.", e);
throw new CobiGenEclipseRuntimeException("The working thread doing the input analyzer job has been interrupted", e);
}
// forward exception thrown in the processing thread if an exception occurred
if (job.isExceptionOccurred()) {
throw job.getOccurredException();
}
this.matchingTemplates = job.getResultMatchingTemplates();
LOG.debug("Matching templates: {}", this.matchingTemplates);
this.singleNonContainerInput = job.isResultSingleNonContainerInput();
LOG.debug("SingleNonContainerInput: {}", this.singleNonContainerInput);
LOG.debug("Finished analyzing generation input.");
});
}
use of com.devonfw.cobigen.eclipse.common.exceptions.CobiGenEclipseRuntimeException in project cobigen by devonfw.
the class SelectFileLabelProvider method checkStateChanged.
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
synchronized (this.selectedIncrements) {
// Increments selection has been changed
if (event.getSource() instanceof CheckboxTreeViewer) {
CheckboxTreeViewer incrementSelector = (CheckboxTreeViewer) event.getSource();
CheckStateListener listener = new CheckStateListener(this.cobigenWrapper, null, this.batch);
listener.performCheckLogic(event, incrementSelector);
Set<Object> selectedElements = new HashSet<>(Arrays.asList(((CheckboxTreeViewer) event.getSource()).getCheckedElements()));
this.selectedIncrements.clear();
for (Object o : selectedElements) {
if (o instanceof IncrementTo) {
this.selectedIncrements.add((IncrementTo) o);
} else {
throw new CobiGenEclipseRuntimeException("Unexpected increment type '" + o.getClass().getCanonicalName() + "' !");
}
}
}
}
}
Aggregations