Skip to content
Snippets Groups Projects
Commit c63f4227 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

#622

parent d08754d7
No related branches found
No related tags found
No related merge requests found
......@@ -879,17 +879,23 @@ public final class CurrentAnalysisEditorBean {
* The class of the repository to be added.
*/
public void addRepository(final Class<AbstractRepository> clazz) {
// Create a new instance for the model
final MIRepository repository = this.factory.createRepository();
repository.setClassname(clazz.getName());
repository.setName(clazz.getSimpleName());
try {
// Create a new instance for the model
final MIRepository repository = this.factory.createRepository();
repository.setClassname(clazz.getName());
repository.setName(clazz.getSimpleName());
this.fillProperties(clazz, repository);
synchronized (this) {
// Add it to the project - and to the graph
this.project.getRepositories().add(repository);
this.currentAnalysisEditorGraphBean.addRepository(repository);
this.currentAnalysisEditorGraphBean.refreshGraph();
this.fillProperties(clazz, repository);
synchronized (this) {
// Add it to the project - and to the graph
this.project.getRepositories().add(repository);
this.currentAnalysisEditorGraphBean.addRepository(repository);
this.currentAnalysisEditorGraphBean.refreshGraph();
}
} catch (final NoClassDefFoundError ex) {
// This exception can occur if (for example) a class is missing
CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured during the creation of the repository. Check the dependencies.");
CurrentAnalysisEditorBean.LOG.error("An error occured during the creation of the repository. Check the dependencies.", ex);
}
}
......@@ -900,31 +906,37 @@ public final class CurrentAnalysisEditorBean {
* The class of the plugin to be added. This can be both, a filter or a reader.
*/
public void addPlugin(final Class<AbstractPlugin> clazz) {
// Create a new instance for the model
final MIPlugin plugin;
if (this.classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(clazz)) {
plugin = this.factory.createReader();
} else {
plugin = this.factory.createFilter();
}
plugin.setClassname(clazz.getName());
plugin.setName(clazz.getSimpleName());
try {
// Create a new instance for the model
final MIPlugin plugin;
if (this.classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(clazz)) {
plugin = this.factory.createReader();
} else {
plugin = this.factory.createFilter();
}
plugin.setClassname(clazz.getName());
plugin.setName(clazz.getSimpleName());
this.fillProperties(clazz, plugin);
this.fillPorts(clazz, plugin);
this.fillDisplays(clazz, plugin);
this.fillProperties(clazz, plugin);
this.fillPorts(clazz, plugin);
this.fillDisplays(clazz, plugin);
synchronized (this) {
// Add it to the project
this.project.getPlugins().add(plugin);
synchronized (this) {
// Add it to the project
this.project.getPlugins().add(plugin);
// Add the element to the graph
if (plugin instanceof MIReader) {
this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin);
} else {
this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin);
// Add the element to the graph
if (plugin instanceof MIReader) {
this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin);
} else {
this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin);
}
this.currentAnalysisEditorGraphBean.refreshGraph();
}
this.currentAnalysisEditorGraphBean.refreshGraph();
} catch (final NoClassDefFoundError ex) {
// This exception can occur if (for example) a class is missing
CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured during the creation of the plugin. Check the dependencies.");
CurrentAnalysisEditorBean.LOG.error("An error occured during the creation of the plugin. Check the dependencies.", ex);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment