From 5b32d38156765a190df95f641770ebbfc8b5104b Mon Sep 17 00:00:00 2001
From: Nils Christian Ehmke <nie@informatik.uni-kiel.de>
Date: Sat, 16 Jun 2012 23:00:07 +0200
Subject: [PATCH] Removed a renaming-bug.

---
 .../session/CurrentWorkSpaceProjectBean.java  | 42 +++++++++++++++++++
 .../src/main/webapp/AnalysisEditor.xhtml      |  2 +-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java
index b2460efe..8428d428 100644
--- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java
+++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java
@@ -930,6 +930,48 @@ public final class CurrentWorkSpaceProjectBean {
 		}
 	}
 
+	/**
+	 * Delivers the name of the currently selected plugin/repository. This is only necessary for the correct renaming of the components.
+	 * 
+	 * @return The name of the plugin/repository.
+	 */
+	public String getCurrentPluginName() {
+		synchronized (this) {
+			if (this.selectedPlugin != null) {
+				return this.selectedPlugin.getName();
+			} else {
+				return this.selectedRepository.getName();
+			}
+		}
+	}
+
+	/**
+	 * Sets the name of the currently selected plugin/repository. This is only necessary for the correct renaming of the components.
+	 * 
+	 * @param newName
+	 *            The new name of the plugin/repository.
+	 */
+	public void setCurrentPluginName(final String newName) {
+		synchronized (this) {
+			// Rename the plugin/repository and get the old name for the hash map
+			if (this.selectedPlugin != null) {
+				final String oldName = this.selectedPlugin.toString();
+				final MIPlugin plugin = this.pluginMap.get(oldName);
+				this.selectedPlugin.setName(newName);
+
+				// Update the hash map
+				this.pluginMap.put(plugin.toString(), plugin);
+			} else {
+				final String oldName = this.selectedRepository.toString();
+				final MIRepository repository = this.repositoryMap.get(oldName);
+				this.selectedRepository.setName(newName);
+
+				// Update the hash map
+				this.repositoryMap.put(repository.toString(), repository);
+			}
+		}
+	}
+
 	/**
 	 * Delivers the valid connections (between the filters) within the current main project.
 	 * 
diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml
index b18b7843..ad7d309d 100644
--- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml
+++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml
@@ -110,7 +110,7 @@
                                 </f:facet>
                                 <f:facet name="input">
                                     <h:inputText value="#{property.value}" rendered="#{not stringBean.checkString(property)}"/>
-                                    <h:inputText value="#{currentWorkSpaceProjectBean.selectedPlugin.name}" rendered="#{stringBean.checkString(property)}"/>
+                                    <h:inputText value="#{currentWorkSpaceProjectBean.currentPluginName}" rendered="#{stringBean.checkString(property)}"/>
                                 </f:facet>  
                             </p:cellEditor>
                         </p:column>
-- 
GitLab