project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/TranslationUnitListener.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/TranslationUnitListener.java Fri Apr 03 23:33:03 2009 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.carbide.internal.cpp.epoc.engine.model;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTNode;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.ITranslationUnitListener;
+import com.nokia.cpp.internal.api.utils.core.*;
+
+/**
+ * Listen to unauthorized external changes to the TU
+ */
+class TranslationUnitListener implements ITranslationUnitListener {
+ private boolean changesAllowed;
+ public void allowChanges(boolean allowed) {
+ Check.checkState(allowed != changesAllowed);
+ changesAllowed = allowed;
+ }
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.api.cpp.epoc.engine.dom.ITranslationUnitListener#changedNode(com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTNode)
+ */
+ public void changedNode(IASTNode node) {
+ if (!changesAllowed)
+ throw new IllegalStateException("illegal change to translation unit outside model or view"); //$NON-NLS-1$
+ }
+
+}
\ No newline at end of file