From 9c1958b66b2ce87563687599753733a95fa7e314 Mon Sep 17 00:00:00 2001
From: Florian Hoelzl <hoelzl@fortiss.org>
Date: Wed, 4 Jan 2012 16:42:50 +0000
Subject: [PATCH] YELLOW again kernel.ui GREEN due to automatic Eclipse
 refactoring refs 343

---
 .../kernel/ui/internal/ActionService.java     |  4 +-
 .../kernel/ui/internal/MarkerService.java     |  4 +-
 .../kernel/ui/internal/NavigatorService.java  |  4 +-
 .../kernel/internal/PersistencyService.java   | 37 +++++++++----------
 .../listener/IPersistencyServiceListener.java | 28 ++++++++------
 5 files changed, 41 insertions(+), 36 deletions(-)

diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java
index 85d544d9b..fc3593a77 100644
--- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java
+++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java
@@ -44,7 +44,7 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils;
  * @author hoelzlf
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: B033E4456F7E06AC68BDC015C379828D
+ * @ConQAT.Rating GREEN Hash: 2F4A149F6F23086BCAEBCBEFBB1B0F04
  */
 public class ActionService implements IActionService,
 		IPersistencyServiceListener, CommandStackListener {
@@ -163,7 +163,7 @@ public class ActionService implements IActionService,
 
 	/** {@inheritDoc} */
 	@Override
-	public void topLevelElementChanged(ITopLevelElement element) {
+	public void topLevelElementContentChanged(ITopLevelElement element) {
 		// ignore
 	}
 }
diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java
index 83a899538..9fe9edb94 100644
--- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java
+++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java
@@ -53,7 +53,7 @@ import org.fortiss.tooling.kernel.ui.service.IMarkerService;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: 527F60B9EBA7E63334F61F244B9AFBBB
+ * @ConQAT.Rating GREEN Hash: FA78F16C3A1FB73F1E1E0B83A31D26FE
  */
 public class MarkerService implements IMarkerService,
 		IPersistencyServiceListener, ILightweightLabelDecorator {
@@ -194,7 +194,7 @@ public class MarkerService implements IMarkerService,
 
 	/** {@inheritDoc} */
 	@Override
-	public void topLevelElementChanged(ITopLevelElement element) {
+	public void topLevelElementContentChanged(ITopLevelElement element) {
 		doConstraintCheck(element);
 	}
 
diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/NavigatorService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/NavigatorService.java
index db918b73c..3b27a6b56 100644
--- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/NavigatorService.java
+++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/NavigatorService.java
@@ -51,7 +51,7 @@ import org.fortiss.tooling.kernel.ui.service.INavigatorService;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: E72006B67EC12232406EF672FC11B015
+ * @ConQAT.Rating GREEN Hash: ACBA4AE08B1DA060E04A7506214F0B65
  */
 public class NavigatorService implements INavigatorService,
 		IPersistencyServiceListener, CommandStackListener {
@@ -134,7 +134,7 @@ public class NavigatorService implements INavigatorService,
 
 	/** {@inheritDoc} */
 	@Override
-	public void topLevelElementChanged(final ITopLevelElement element) {
+	public void topLevelElementContentChanged(final ITopLevelElement element) {
 		new UIJob("NavigatorServiceSafeableRefresh") {
 			@Override
 			public IStatus runInUIThread(IProgressMonitor monitor) {
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java
index 07a6e7540..037079e4b 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java
@@ -52,7 +52,7 @@ import org.osgi.framework.Bundle;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating YELLOW Hash: 4F70931B343453F4C70065EF91708C65
+ * @ConQAT.Rating YELLOW Hash: 9BF50F6FC323A8BC88FE455D7EB05F9F
  */
 public class PersistencyService implements IPersistencyService {
 
@@ -66,8 +66,7 @@ public class PersistencyService implements IPersistencyService {
 	private final List<IStorageProvider> storageProviderList = new ArrayList<IStorageProvider>();
 
 	/** Stores the top-level element contexts. */
-	// TODO: ich finde den Begriff context nicht selbsterklärend
-	private final List<ITopLevelElement> contextCache = new LinkedList<ITopLevelElement>();
+	private final List<ITopLevelElement> elementCache = new LinkedList<ITopLevelElement>();
 
 	/** Stores the dummy top-level element contexts. */
 	private Map<EObject, ITopLevelElement> dummyCache = null;
@@ -87,13 +86,13 @@ public class PersistencyService implements IPersistencyService {
 	/** {@inheritDoc} */
 	@Override
 	public synchronized UnmodifiableList<ITopLevelElement> getTopLevelElements() {
-		return CollectionUtils.asUnmodifiable(contextCache);
+		return CollectionUtils.asUnmodifiable(elementCache);
 	}
 
 	/** {@inheritDoc} */
 	@Override
 	public synchronized boolean isTopLevelElement(EObject element) {
-		for (ITopLevelElement context : contextCache) {
+		for (ITopLevelElement context : elementCache) {
 			if (context.getRootModelElement() == element) {
 				return true;
 			}
@@ -104,7 +103,7 @@ public class PersistencyService implements IPersistencyService {
 	/** {@inheritDoc} */
 	@Override
 	public synchronized boolean isDirty() {
-		for (ITopLevelElement context : contextCache) {
+		for (ITopLevelElement context : elementCache) {
 			if (context.isDirty()) {
 				return true;
 			}
@@ -115,7 +114,7 @@ public class PersistencyService implements IPersistencyService {
 	/** {@inheritDoc} */
 	@Override
 	public synchronized void doSave(IProgressMonitor monitor) {
-		for (ITopLevelElement context : contextCache) {
+		for (ITopLevelElement context : elementCache) {
 			if (context.isDirty()) {
 				try {
 					context.doSave(monitor);
@@ -140,24 +139,24 @@ public class PersistencyService implements IPersistencyService {
 		List<ITopLevelElement> providedElements = provider
 				.getTopLevelElements();
 		List<ITopLevelElement> removedCacheElements = new LinkedList<ITopLevelElement>();
-		// TODO: ein Kommentar hier wäre hilfreich
-		for (ITopLevelElement top : contextCache) {
+		// determine cache elements no longer provided
+		for (ITopLevelElement top : elementCache) {
 			if (provider == storageProviderCache.get(top)
 					&& !providedElements.contains(top)) {
 				removedCacheElements.add(top);
 			}
 		}
-		// TODO: ein Kommentar hier wäre hilfreich
+		// determine and notify added elements
 		for (ITopLevelElement top : providedElements) {
-			if (!contextCache.contains(top)) {
-				contextCache.add(top);
+			if (!elementCache.contains(top)) {
+				elementCache.add(top);
 				storageProviderCache.put(top, provider);
 				notifyListenersAboutAdd(top);
 			}
 		}
-		// TODO: ein Kommentar hier wäre hilfreich
+		// remove elements from cache and notify
 		for (ITopLevelElement top : removedCacheElements) {
-			contextCache.remove(top);
+			elementCache.remove(top);
 			storageProviderCache.remove(top);
 			notifyListenersAboutRemove(top);
 		}
@@ -202,7 +201,7 @@ public class PersistencyService implements IPersistencyService {
 			public IStatus runInWorkspace(IProgressMonitor monitor) {
 				synchronized (PersistencyService.this) {
 					for (IPersistencyServiceListener listener : listeners) {
-						listener.topLevelElementChanged(top);
+						listener.topLevelElementContentChanged(top);
 					}
 				}
 				return Status.OK_STATUS;
@@ -215,7 +214,7 @@ public class PersistencyService implements IPersistencyService {
 	public synchronized ITopLevelElement getTopLevelElementFor(
 			EObject modelElement) {
 		while (modelElement != null) {
-			for (ITopLevelElement context : contextCache) {
+			for (ITopLevelElement context : elementCache) {
 				if (context.getRootModelElement() == modelElement) {
 					return context;
 				}
@@ -246,7 +245,7 @@ public class PersistencyService implements IPersistencyService {
 	private void initializeTopLevelElementContexts() {
 		for (IStorageProvider provider : storageProviderList) {
 			for (ITopLevelElement context : provider.getTopLevelElements()) {
-				contextCache.add(context);
+				elementCache.add(context);
 				storageProviderCache.put(context, provider);
 			}
 		}
@@ -260,7 +259,7 @@ public class PersistencyService implements IPersistencyService {
 		}
 		DummyTopLevelElement dummy = new DummyTopLevelElement(dummyRoot);
 		dummyCache.put(dummyRoot, dummy);
-		contextCache.add(dummy);
+		elementCache.add(dummy);
 	}
 
 	/** {@inheritDoc} */
@@ -269,7 +268,7 @@ public class PersistencyService implements IPersistencyService {
 		if (dummyCache == null || !dummyCache.containsKey(dummy)) {
 			return;
 		}
-		contextCache.remove(dummyCache.get(dummy));
+		elementCache.remove(dummyCache.get(dummy));
 		dummyCache.remove(dummy);
 	}
 }
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/listener/IPersistencyServiceListener.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/listener/IPersistencyServiceListener.java
index e646a4dd1..1f963b5e2 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/listener/IPersistencyServiceListener.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/listener/IPersistencyServiceListener.java
@@ -21,27 +21,33 @@ import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
 
 /**
  * Listener interface notified by the persistency service whenever the list of
- * top-level elements changes or the top-level element changed from the
- * persistency perspective. The latter case usually occurs when the model is
- * saved to disk.
+ * top-level elements changes (element added or removed) or the content of the
+ * top-level element changed. The latter case usually occurs when the model is
+ * saved to disk or a new revision is available remotely.
  * 
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: 76EAC97C783A9B5263C99D3958E9C575
+ * @ConQAT.Rating YELLOW Hash: B6BB618561D7DE7C3F80A60DF509564F
  */
 public interface IPersistencyServiceListener {
 
-	/** Notifies the listener about the adding of the given element. */
+	/**
+	 * Notifies the listener that the given element just appeared in the
+	 * persistency service.
+	 */
 	void topLevelElementAdded(ITopLevelElement element);
 
-	/** Notifies the listener about the removal of the given element. */
+	/**
+	 * Notifies the listener that the given element just disappeared in the
+	 * persistency service.
+	 */
 	void topLevelElementRemoved(ITopLevelElement element);
 
-	/** Notifies the listener that the underlying persistent model has changed. */
-	// TODO: Would it be useful to have the information (here: persistent model)
-	// in
-	// the name?
-	void topLevelElementChanged(ITopLevelElement element);
+	/**
+	 * Notifies the listener that the underlying persistent model content has
+	 * changed.
+	 */
+	void topLevelElementContentChanged(ITopLevelElement element);
 
 }
-- 
GitLab