Skip to content
Snippets Groups Projects
Commit 9c1958b6 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

YELLOW again

kernel.ui GREEN due to automatic Eclipse refactoring
refs 343
parent ed8630fd
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
}
......@@ -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);
}
......
......@@ -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) {
......
......@@ -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 selbsterklrend
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 wre 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 wre 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 wre 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);
}
}
......@@ -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);
}
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