Skip to content
Snippets Groups Projects
Commit c671b000 authored by Sabine Teufl's avatar Sabine Teufl
Browse files

Review

refs 311
parent 1d776095
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,7 @@ import org.osgi.framework.Bundle;
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4F70931B343453F4C70065EF91708C65
*/
// TODO: add information for which option (XML file) this class is implemented
public class PersistencyService implements IPersistencyService {
/** The prototype provider extension point ID. */
......@@ -66,6 +67,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 selbsterklrend
private final List<ITopLevelElement> contextCache = new LinkedList<ITopLevelElement>();
/** Stores the dummy top-level element contexts. */
......@@ -104,6 +106,8 @@ public class PersistencyService implements IPersistencyService {
@Override
public synchronized boolean isDirty() {
for (ITopLevelElement context : contextCache) {
// TODO: warum kann man das nicht unsaved nennen, sondern nennt es
// dirty, wenn unsaved gemeint ist?
if (context.isDirty()) {
return true;
}
......@@ -139,12 +143,14 @@ public class PersistencyService implements IPersistencyService {
List<ITopLevelElement> providedElements = provider
.getTopLevelElements();
List<ITopLevelElement> removedCacheElements = new LinkedList<ITopLevelElement>();
// TODO: ein Kommentar hier wre hilfreich
for (ITopLevelElement top : contextCache) {
if (provider == storageProviderCache.get(top)
&& !providedElements.contains(top)) {
removedCacheElements.add(top);
}
}
// TODO: ein Kommentar hier wre hilfreich
for (ITopLevelElement top : providedElements) {
if (!contextCache.contains(top)) {
contextCache.add(top);
......@@ -152,6 +158,7 @@ public class PersistencyService implements IPersistencyService {
notifyListenersAboutAdd(top);
}
}
// TODO: ein Kommentar hier wre hilfreich
for (ITopLevelElement top : removedCacheElements) {
contextCache.remove(top);
storageProviderCache.remove(top);
......@@ -232,8 +239,8 @@ public class PersistencyService implements IPersistencyService {
IStorageProvider provider = (IStorageProvider) handlerClass
.getConstructor().newInstance();
storageProviderList.add(provider);
} catch (Exception ex) {
error(ToolingKernelActivator.getDefault(), ex.getMessage(), ex);
} catch (Exception e) {
error(ToolingKernelActivator.getDefault(), e.getMessage(), e);
}
}
}
......
......@@ -41,7 +41,7 @@ import org.fortiss.tooling.kernel.service.listener.IPersistencyServiceListener;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: A4BFEC90B06C148D6020E63708A3D6FF
* @ConQAT.Rating GREEN Hash: 3F68893AC08F697E595173204DAE4772
*/
public interface IPersistencyService {
......@@ -69,6 +69,7 @@ public interface IPersistencyService {
ITopLevelElement getTopLevelElementFor(EObject modelElement);
/** Returns whether the some storage provider has unsaved changes. */
// TODO: warum nennt man unsaved dirty?
boolean isDirty();
/** Saves any dirty top-level elements to disk. */
......
......@@ -39,6 +39,8 @@ public interface IPersistencyServiceListener {
void topLevelElementRemoved(ITopLevelElement element);
/** Notifies the listener that the underlying persistent model has changed. */
// Would it be useful to have the information (here: persistent model) in
// the name?
void topLevelElementChanged(ITopLevelElement element);
}
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