@SuppressWarnings("unchecked")
protected void removeLayerListener(IRenderContext context) {
if (context.getLayer() != null) {
Layer layer = ((Layer) context.getLayer());
List<Adapter> adapters = layer.eAdapters();
if (adapters instanceof SynchronizedEList) {
((SynchronizedEList) adapters).lock();
}
try {
ArrayList<Adapter> toRemove = new ArrayList<Adapter>();