initial commit in accordance with CQ 3784
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/.classpath b/plugins/org.eclipse.objectteams.eclipse.monitor/.classpath
new file mode 100644
index 0000000..987380a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="con" path="OTRE"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/.project b/plugins/org.eclipse.objectteams.eclipse.monitor/.project
new file mode 100644
index 0000000..81c3ceb
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.objectteams.eclipse.monitor</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.objectteams.otdt.builder.OTJBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.objectteams.otdt.OTJavaNature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.objectteams.eclipse.monitor/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..4fafd63
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Sun Apr 08 14:46:15 CEST 2007
+eclipse.preferences.version=1
+encoding//src/org/objectteams/eclipse/monitor/MonitorMessages.properties=8859_1
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..12e9c3e
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Thu Mar 12 15:22:18 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.eclipse.monitor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b9b7c48
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OT/Equinox Monitor Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.eclipse.monitor;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Vendor: objectteams.org
+Bundle-Activator: org.eclipse.objectteams.eclipse.monitor.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.objectteams.otequinox
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/build.properties b/plugins/org.eclipse.objectteams.eclipse.monitor/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               icons/
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/icons/auto_refresh.png b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/auto_refresh.png
new file mode 100644
index 0000000..1de43d5
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/auto_refresh.png
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/icons/monitor.png b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/monitor.png
new file mode 100644
index 0000000..d9295e6
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/monitor.png
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/icons/refresh_nav.gif b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/refresh_nav.gif
new file mode 100644
index 0000000..3ca04d0
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/refresh_nav.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/icons/refresh_nav_dis.gif b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/refresh_nav_dis.gif
new file mode 100644
index 0000000..478cff5
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/icons/refresh_nav_dis.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/plugin.xml b/plugins/org.eclipse.objectteams.eclipse.monitor/plugin.xml
new file mode 100644
index 0000000..b678063
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/plugin.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+  <extension
+         point="org.eclipse.ui.views">
+      <category
+            name="Object Teams"
+            id="org.eclipse.objectteams.otdt.ui">
+      </category>
+      <view
+            name="OT/Equinox Monitor"
+			icon="icons/monitor.png"
+            category="org.eclipse.objectteams.otdt.ui"
+            class="org.eclipse.objectteams.eclipse.monitor.MonitorView"
+            id="org.eclipse.objectteams.eclipse.monitor.MonitorView">
+         <description>
+            Presentation of all teams instantiated by OT/Equinox.
+Allows to interactively (de)activate a selected team.
+         </description>
+      </view>
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.perspectiveExtensions">
+      <perspectiveExtension
+            targetID="org.eclipse.ui.resourcePerspective">
+         <view
+               ratio="0.5"
+               relative="org.eclipse.ui.views.TaskList"
+               relationship="right"
+               id="org.eclipse.objectteams.eclipse.monitor.MonitorView">
+         </view>
+      </perspectiveExtension>
+      <perspectiveExtension
+            targetID="org.eclipse.objectteams.otdt.ui.OTJavaPerspective">
+         <viewShortcut
+               id="org.eclipse.objectteams.eclipse.monitor.MonitorView">
+         </viewShortcut>
+      </perspectiveExtension>
+   </extension>
+</plugin>
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/Activator.java b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/Activator.java
new file mode 100644
index 0000000..b574633
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/Activator.java
@@ -0,0 +1,82 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2005, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: Activator.java 23468 2010-02-04 22:34:27Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.eclipse.monitor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * (only used for access to local icons).
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.eclipse.objectteams.eclipse.monitor"; //$NON-NLS-1$
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorMessages.java b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorMessages.java
new file mode 100644
index 0000000..61386d0
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorMessages.java
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2010 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: MonitorMessages.java 23462 2010-02-04 22:13:22Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.eclipse.monitor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class MonitorMessages extends NLS {
+	private static final String BUNDLE_NAME = MonitorMessages.class.getName();
+	
+	public static String button_text_refresh;
+	public static String button_tooltip_refresh;
+
+	public static String button_text_auto_refresh;
+	public static String button_tooltip_auto_refresh;
+
+	public static String job_name_refresh;
+
+	public static String heading_team_class;
+	public static String heading_num_roles;
+
+	public static String tooltip_not_computed;
+	public static String tooltip_roles_of;
+	public static String tooltip_no_roles;
+	
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, MonitorMessages.class);
+	}
+
+	private MonitorMessages() {
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorMessages.properties b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorMessages.properties
new file mode 100644
index 0000000..1fedab6
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorMessages.properties
@@ -0,0 +1,14 @@
+heading_team_class=Team class
+heading_num_roles=\# roles
+
+button_text_refresh=Refresh
+button_tooltip_refresh=Recompute all table data
+
+button_text_auto_refresh=Auto Refresh
+button_tooltip_auto_refresh=Periodically update the number of roles
+
+job_name_refresh=OT/Equinox Monitor Refresher
+
+tooltip_not_computed=no data computed, please select row to compute its details.
+tooltip_roles_of=Roles of 
+tooltip_no_roles=No roles.
diff --git a/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorView.java b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorView.java
new file mode 100644
index 0000000..e7b4854
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.eclipse.monitor/src/org/eclipse/objectteams/eclipse/monitor/MonitorView.java
@@ -0,0 +1,261 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2010 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: MonitorView.java 23462 2010-02-04 22:13:22Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.eclipse.monitor;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.objectteams.otequinox.TransformerPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+import org.objectteams.Team;
+
+// Copy&Paste: the GUI-stuff is partly inspired by the AboutPluginsDialog.
+public class MonitorView extends ViewPart {
+	
+	private static final String IMG_AUTO_REFRESH = "icons/auto_refresh.png"; //$NON-NLS-1$
+	private static final String IMG_REFRESH = "icons/refresh_nav.gif"; //$NON-NLS-1$
+	private static final String IMG_REFRESH_DISABLED = "icons/refresh_nav_dis.gif"; //$NON-NLS-1$
+	
+	/** The main widget: */
+	private Table table;
+	// actions:
+	private Action refreshAction;
+	private Action toggleAutoRefreshAction;
+	private boolean autoRefresh = true;
+
+	/** Stored texts for tooltips: */
+	private HashMap<Widget, String> hoverTexts = new HashMap<Widget, String>();
+
+	/**
+	 * Setup the GUI.
+	 */
+	public void createPartControl(Composite parent) {
+		table = new Table(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
+        table.setHeaderVisible(true);
+        table.setLinesVisible(true);
+        table.setFont(parent.getFont());
+        
+
+        // create table headers
+        String[] columnTitles = { MonitorMessages.heading_team_class, MonitorMessages.heading_num_roles };
+        int   [] columnWidths = { 500,          50        };
+        for (int i = 0; i < columnTitles.length; i++) {
+            TableColumn column = new TableColumn(table, SWT.NULL);
+            column.setWidth(columnWidths[i]);
+            column.setText(columnTitles[i]);
+        }
+        
+        readTeams();
+        
+        table.addSelectionListener(new SelectionAdapter() {
+        	public void widgetSelected(SelectionEvent e) {
+        		printDetails(e.item);
+        	}
+        });
+        table.addMouseTrackListener(new MouseTrackAdapter() {
+        	@Override
+        	public void mouseHover(MouseEvent e) {
+        		TableItem item = table.getItem(new Point(e.x, e.y));
+        		String hoverText = hoverTexts.get(item);
+        		if (hoverText != null)
+        			table.setToolTipText(hoverText);
+        		else
+        			table.setToolTipText(MonitorMessages.tooltip_not_computed);
+        	}
+        });
+
+        GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+        table.setLayoutData(gridData);
+
+        final Display display = parent.getDisplay();
+        makeActions(display);      
+		contributeToActionBars();
+	}
+
+	private void makeActions(final Display display) {
+		refreshAction = new Action() {
+			public void run() {
+				refreshAll();
+			}
+		};
+		refreshAction.setText(MonitorMessages.button_text_refresh);
+		refreshAction.setToolTipText(MonitorMessages.button_tooltip_refresh);
+		refreshAction.setDisabledImageDescriptor(Activator.getImageDescriptor(IMG_REFRESH_DISABLED));
+		refreshAction.setImageDescriptor(Activator.getImageDescriptor(IMG_REFRESH));
+		
+		toggleAutoRefreshAction = new Action() {
+			public void run() {
+				autoRefresh = !autoRefresh;
+				if (autoRefresh)
+					startAutoRefreshJob(display);					
+			}
+		};
+		toggleAutoRefreshAction.setChecked(true); // make this a checkbox.
+		toggleAutoRefreshAction.setText(MonitorMessages.button_text_auto_refresh);
+		toggleAutoRefreshAction.setToolTipText(MonitorMessages.button_tooltip_auto_refresh);
+		toggleAutoRefreshAction.setImageDescriptor(Activator.getImageDescriptor(IMG_AUTO_REFRESH));
+		
+        startAutoRefreshJob(display);  // on by default.
+	}
+	
+	private void contributeToActionBars() {
+		IActionBars bars = getViewSite().getActionBars();
+		bars.getToolBarManager().add(refreshAction);
+		bars.getToolBarManager().add(toggleAutoRefreshAction);
+	}
+	
+	/**
+	 * Start a background job that will call back into the UI every second for refresh.
+	 */
+	void startAutoRefreshJob(final Display display) {
+		Job job = new Job(MonitorMessages.job_name_refresh) {
+			protected IStatus run(IProgressMonitor monitor) {
+				// need asyncExec to call GUI code from a non-GUI thread:
+				display.asyncExec(new Runnable() {
+					public void run() {
+						refreshTableData();
+					}
+				});        		
+				if (autoRefresh)
+					this.schedule(1000); // keep going.
+				return Status.OK_STATUS;
+			}
+		};
+		job.setPriority(Job.SHORT);
+		job.schedule(1000);
+	}
+
+	/**
+	 * Passing the focus request to the viewer's control.
+	 */
+	public void setFocus() {
+		table.setFocus();
+	}
+
+	// ====  contents computations only below: ====
+	
+	void readTeams() {
+		// fetch instantiated teams:
+		List<Team> teamList = new ArrayList<Team>();
+		TransformerPlugin.getTeamInstances(teamList);
+	
+		// create rows and fill with data:
+	    for (int i = 0; i < teamList.size(); ++i) {
+	    	Team      aTeam = teamList.get(i);
+	        TableItem item  = new TableItem(table, SWT.NULL);
+	        item.setData(aTeam);
+	        item.setChecked(aTeam.isActive(Team.ALL_THREADS));
+	        setupData(item);
+	    }
+	}
+	
+	void refreshAll() {
+		this.table.removeAll();
+		readTeams();
+		refreshTableData();
+	}
+
+	/** Set the texts from the contained Team instance. */
+	private boolean setupData(TableItem item) {
+		Team aTeam = (Team)item.getData();
+		item.setText(0, aTeam.getClass().getName());
+		String oldLength = item.getText(1);
+		String newLength = String.valueOf(aTeam.getAllRoles().length);
+		item.setText(1, newLength);
+		return oldLength == null || !oldLength.equals(newLength);
+	}
+	
+	/** re-read the role statistics from all known teams 
+	 */
+	void refreshTableData() {
+		if (table.isDisposed()) {
+			autoRefresh = false;
+			return;
+		}			
+		for(TableItem item : table.getItems()) {
+			if (setupData(item))
+				hoverTexts.remove(item);
+		}
+	}
+	
+	/** Print to std out details about the selected team:
+	 *  How many roles of which class are registered?
+	 *  Also store these infos for display in tooltips.
+	 */
+	void printDetails(Widget item) {
+		StringBuilder buf = new StringBuilder();
+		
+		Team   aTeam    = (Team)item.getData();
+		String teamName = aTeam.getClass().getName();
+		buf.append(MonitorMessages.tooltip_roles_of+teamName);
+		
+		Object[] allRoles = aTeam.getAllRoles();
+		if (allRoles.length == 0) {
+			buf.append('\n');
+			buf.append(MonitorMessages.tooltip_no_roles);
+		} else {
+			// sort roles by class:
+			HashMap<Class<?>, Integer> stats = new HashMap<Class<?>, Integer>();
+			for (Object aRole : allRoles) {
+				Integer i =  stats.get(aRole.getClass());
+				if (i != null)
+					i = i+1;
+				else 
+					i = 1;
+				stats.put(aRole.getClass(), i);
+			}
+			// append stats per class:
+			for (Entry<Class<?>, Integer> stat: stats.entrySet()) {
+				int prefixLen = teamName.length() + "$__OT__".length(); // single name for roles //$NON-NLS-1$
+				String roleName = stat.getKey().getName().substring(prefixLen);
+				buf.append("\n"+stat.getValue()+"\t"+roleName); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}
+		System.out.println(buf.toString());
+		hoverTexts.put(item, buf.toString());
+		
+		boolean checked = ((TableItem)item).getChecked();
+		if (checked !=  aTeam.isActive(Team.ALL_THREADS)) {
+			if (checked)
+				aTeam.activate(Team.ALL_THREADS);
+			else
+				aTeam.deactivate(Team.ALL_THREADS);
+		}
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/.classpath b/plugins/org.eclipse.objectteams.otdt.apt/.classpath
new file mode 100644
index 0000000..a44caa7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="OTRE"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/.project b/plugins/org.eclipse.objectteams.otdt.apt/.project
new file mode 100644
index 0000000..5fe09fa
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.objectteams.otdt.apt</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.objectteams.otdt.builder.OTJBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.objectteams.otdt.OTJavaNature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otdt.apt/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..9eeb571
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,19 @@
+#Wed Mar 04 21:29:01 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.objectteams.otdt.compiler.option.joinpoint_queries=disabled
+org.objectteams.otdt.compiler.option.scoped_keywords=enabled
+org.objectteams.otdt.compiler.problem.abstract_potential_relevant_role=warning
+org.objectteams.otdt.compiler.problem.basecall=warning
+org.objectteams.otdt.compiler.problem.binding_conventions=warning
+org.objectteams.otdt.compiler.problem.decapsulation=warning
+org.objectteams.otdt.compiler.problem.deprecated_path_syntax=warning
+org.objectteams.otdt.compiler.problem.fragile_callin=warning
+org.objectteams.otdt.compiler.problem.inferred_callout=warning
+org.objectteams.otdt.compiler.problem.potential_ambiguous_playedby=warning
+org.objectteams.otdt.compiler.problem.unsafe_role_instantiation=warning
+org.objectteams.otdt.compiler.problem.weave_into_system_class=warning
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.apt/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9679f6b
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Adaptor for the JDT/APT
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.apt;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Bundle-Vendor: objectteams.org
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.objectteams.otequinox;bundle-version="[1.2.6,2.0.0)",
+ org.eclipse.osgi;bundle-version="[3.4.2,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.5.0.v_OTDT_r130,4.0.0)"
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/build.properties b/plugins/org.eclipse.objectteams.otdt.apt/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/plugin.xml b/plugins/org.eclipse.objectteams.otdt.apt/plugin.xml
new file mode 100644
index 0000000..2a82377
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/plugin.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.objectteams.otequinox.aspectBindings">
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.core">
+               <requiredFragment 
+               		id="org.eclipse.jdt.compiler.apt">
+               </requiredFragment>
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.apt.VisitorsAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+   </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.objectteams.otdt.apt/src/org/eclipse/objectteams/otdt/apt/VisitorsAdaptor.java b/plugins/org.eclipse.objectteams.otdt.apt/src/org/eclipse/objectteams/otdt/apt/VisitorsAdaptor.java
new file mode 100644
index 0000000..02ca6df
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.apt/src/org/eclipse/objectteams/otdt/apt/VisitorsAdaptor.java
@@ -0,0 +1,82 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2009 Stephan Herrmann
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: VisitorsAdaptor.java 23449 2010-02-04 20:26:45Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.apt;
+
+import org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.lookup.AptSourceLocalVariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.Binding;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.objectteams.otdt.internal.core.compiler.ast.AbstractMethodMappingDeclaration;
+import org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies;
+import org.eclipse.objectteams.otdt.internal.core.compiler.control.ITranslationStates;
+import org.eclipse.objectteams.otdt.internal.core.compiler.model.RoleModel;
+
+import base org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor;
+
+/**
+ * This class adapts visitors used in annotation processing that need to be aware of
+ * OT extensions of the compiler ast - 
+ * currently only {@link org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor}.
+ * 
+ * @author stephan
+ * @since 1.2.7
+ */
+@SuppressWarnings("restriction")
+public team class VisitorsAdaptor {
+	protected class AnnotationDiscoveryVisitor playedBy AnnotationDiscoveryVisitor {
+
+		@SuppressWarnings("decapsulation")
+		void resolveAnnotations(BlockScope arg0, Annotation[] arg1, Binding arg2)
+			-> void resolveAnnotations(BlockScope arg0, Annotation[] arg1, Binding arg2);
+
+
+		boolean visit(Argument argument, BlockScope scope) 
+			<- replace boolean visit(Argument argument, BlockScope scope);
+
+
+		@SuppressWarnings("basecall")
+		callin boolean visit(Argument argument, BlockScope scope) {
+			if (scope.kind == Scope.BINDING_SCOPE) { // don't blindly assume that we're inside a method
+				Annotation[] annotations = argument.annotations;
+				// the payload (orig uses cast to AbstractMethodDeclaration):
+				AbstractMethodMappingDeclaration mapping = (AbstractMethodMappingDeclaration) scope.referenceContext();
+				RoleModel roleModel = scope.referenceType().getRoleModel();
+				if (roleModel != null)
+					Dependencies.ensureRoleState(roleModel, ITranslationStates.STATE_MAPPINGS_RESOLVED); // needed for accessing the method binding.
+				MethodBinding binding = mapping.getRoleMethod(); 
+				//
+				if (binding != null) {
+					TypeDeclaration typeDeclaration = scope.referenceType();
+					typeDeclaration.binding.resolveTypesFor(binding);
+					if (argument.binding != null) {
+						argument.binding = new AptSourceLocalVariableBinding(argument.binding, binding);
+					}
+				}
+				if (annotations != null) {
+					this.resolveAnnotations(
+							scope,
+							annotations,
+							argument.binding);
+				}
+				return false;
+			} else {
+				return base.visit(argument, scope);
+			}
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.classpath b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.classpath
new file mode 100644
index 0000000..987380a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="con" path="OTRE"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.project b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.project
new file mode 100644
index 0000000..12e57b3
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.project
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.objectteams.otdt.compiler.adaptor</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.objectteams.otdt.builder.OTJBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.objectteams.otdt.OTJavaNature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3b91683
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,85 @@
+#Sun Nov 09 02:20:07 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.objectteams.otdt.compiler.option.joinpoint_queries=disabled
+org.objectteams.otdt.compiler.option.scoped_keywords=enabled
+org.objectteams.otdt.compiler.problem.abstract_potential_relevant_role=warning
+org.objectteams.otdt.compiler.problem.basecall=warning
+org.objectteams.otdt.compiler.problem.binding_conventions=error
+org.objectteams.otdt.compiler.problem.decapsulation=warning
+org.objectteams.otdt.compiler.problem.deprecated_path_syntax=warning
+org.objectteams.otdt.compiler.problem.effectless_fieldaccess=warning
+org.objectteams.otdt.compiler.problem.fragile_callin=warning
+org.objectteams.otdt.compiler.problem.incomplete_build=error
+org.objectteams.otdt.compiler.problem.inferred_callout=error
+org.objectteams.otdt.compiler.problem.potential_ambiguous_playedby=warning
+org.objectteams.otdt.compiler.problem.unsafe_liftctor=warning
+org.objectteams.otdt.compiler.problem.unsafe_role_instantiation=warning
+org.objectteams.otdt.compiler.problem.unused_parammap=warning
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b43819b
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OT/J Compiler Adaptor Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.compiler.adaptor;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Bundle-Vendor: objectteams.org
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.jdt.core;bundle-version="[3.4.2.vOTDT_r124,4.0.0)",
+ org.eclipse.objectteams.otequinox,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.pde.core,
+ org.eclipse.objectteams.otdt
+Export-Package: org.eclipse.objectteams.otdt.internal.compiler.adaptor
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/build.properties b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/plugin.xml b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/plugin.xml
new file mode 100644
index 0000000..36e2732
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/plugin.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.objectteams.otequinox.aspectBindings">
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.core"/>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.AdaptorActivator"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"/>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.BuildManager"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+               superclass="org.eclipse.objectteams.otdt.internal.compiler.adaptor.CompilationThreadWatcher"/>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.CompilationThreadWatcher"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"/>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.BaseImportChecker"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+               superclass="org.eclipse.objectteams.otdt.internal.compiler.adaptor.CompilationThreadWatcher"/>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.RoleReuseGuard"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.PlainProjectWatcher"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+               superclass="org.eclipse.objectteams.otdt.internal.compiler.adaptor.CompilationThreadWatcher">
+         </team>
+      </aspectBinding>
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.pde.core">
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.PDEAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.core.resources">
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.compiler.adaptor.ResourceProjectAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+   </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AdaptedBaseBundle.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AdaptedBaseBundle.java
new file mode 100644
index 0000000..fa33586
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AdaptedBaseBundle.java
@@ -0,0 +1,115 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: AdaptedBaseBundle.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Objects of this class encode the information about aspectBindings
+ * affecting a given type/package within a base bundle.
+ * 
+ * @author stephan
+ * @since 1.1.5
+ */
+public class AdaptedBaseBundle 
+{
+	// the Object-value is used as a time stamp for reloading after the reader has been reloaded:
+	private HashMap<AspectBindingReader,Object> readers= new HashMap<AspectBindingReader, Object>();
+	
+	
+	/** Symbolic name of this base bundle. */
+	String symbolicName;
+	/** Teams adapting this base bundle. */
+	Set<String> adaptingTeams;
+	
+	/** Does this aspect bundle have one or more split packages? */
+	public boolean hasPackageSplit = false; 
+
+	public AdaptedBaseBundle(String symbolicName,
+							 AspectBindingReader reader)
+	{
+		this.symbolicName = symbolicName;
+		this.adaptingTeams= reader.getTeamsForBase(symbolicName);			
+		this.readers.put(reader, reader.token);
+	}
+	public boolean isAdaptedBy(String teamName) {
+		checkReload();
+		for (String aTeam : adaptingTeams)
+			if (aTeam.equals(teamName))
+				return true;
+		return false;
+	}
+	
+	public String getSymbolicName() {
+		return this.symbolicName;
+	}
+	
+	public synchronized boolean merge(AdaptedBaseBundle otherData) {
+		if (this.symbolicName.equals(otherData.symbolicName)) {
+			this.adaptingTeams.addAll(otherData.adaptingTeams);
+			this.readers.putAll(otherData.readers);
+			return true;
+		} else {
+			// different base bundle but same package: split package
+			return false;
+		}
+	}
+	
+	/** Check whether the AspectBindingReader has been reloaded, and if so,
+	 *  also reload our data (adaptingTeams) from the reader. */
+	private void checkReload() {
+		synchronized (this.readers) {
+			boolean reloadNeeded= false;
+			for (Map.Entry<AspectBindingReader,Object> readerEntry : this.readers.entrySet()) {
+				AspectBindingReader reader= readerEntry.getKey();
+				if (readerEntry.getValue() != reader.token) {
+					// token changed means: reader has reloaded.
+					reloadNeeded= true;
+					this.readers.put(reader, reader.token);
+				}
+			}
+			if (!reloadNeeded)
+				return;
+			// perform the reload:
+			HashSet<String> newSet= new HashSet<String>();
+			for (AspectBindingReader reader: this.readers.keySet())
+				newSet.addAll(reader.getTeamsForBase(this.symbolicName));
+			this.adaptingTeams= newSet; // only now assign, because querying the readers might call back into this!
+		}
+	}
+	
+	@SuppressWarnings("nls")
+	@Override
+	public String toString() {
+		String result= "bundle "+this.symbolicName+" is adapted by";
+		if (this.adaptingTeams == null)
+			return result+" (null)";
+		if (this.adaptingTeams.isEmpty())
+			return result+" no teams";
+		for (String aTeam : this.adaptingTeams) {
+			result+= "\n\t"+aTeam;
+		}
+		return result;
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AdaptorActivator.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AdaptorActivator.java
new file mode 100644
index 0000000..59e30c1
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AdaptorActivator.java
@@ -0,0 +1,371 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: AdaptorActivator.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import static org.eclipse.core.resources.IncrementalProjectBuilder.FULL_BUILD;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.core.internal.resources.Project;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.WorkingCopyOwner;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.SourceElementParser;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.jdt.internal.compiler.util.ObjectVector;
+import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
+import org.eclipse.jdt.internal.core.ClasspathAccessRule;
+import org.eclipse.jdt.internal.core.CompilationUnit;
+import org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer;
+import org.objectteams.LiftingVetoException;
+import org.objectteams.Team;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+import org.eclipse.objectteams.otdt.core.compiler.OTNameUtils;
+
+import base org.eclipse.jdt.core.JavaCore;
+import base org.eclipse.jdt.internal.core.CompilationUnitProblemFinder;
+import base org.eclipse.jdt.internal.core.JavaProject;
+import base org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder;
+import base org.eclipse.jdt.internal.core.builder.JavaBuilder;
+import base org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.CopyInheritance;
+
+/**
+ * This team is activated via the OT/Equinox transformer plugin.
+ * It controls the activation of the BuildManager and BaseImportChecker teams.
+ * 
+ * Control entry for BuildManager: IncrementalImageBuilder.
+ * Control entries for BaseImportChecker: JavaBuilder and CompilationUnitProblemFinder
+ * @author stephan
+ */
+@SuppressWarnings("restriction")
+public team class AdaptorActivator 
+{
+	/**
+	 * Name of classpath attributes denoting the base bundle from which a classpath entry originates.
+	 * Persistently stored so we can later associate aspect binding data to that classpath entry. 
+	 */
+	public static final String CPENTRY_ATTR_ORIGIN_BASE_BUNDLE = "org.eclipse.objectteams.originBaseBundle"; //$NON-NLS-1$
+
+	/**
+	 * Copy of a constant from PDECore to reduce dependencies (must be compared with .equals())).
+	 */
+	public static final IPath REQUIRED_PLUGINS_CONTAINER_PATH = new Path("org.eclipse.pde.core.requiredPlugins"); //$NON-NLS-1$
+
+	
+	public static AdaptorActivator instance;
+	public AdaptorActivator() {
+		instance= this;
+	}
+
+	/** 
+	 * Pass the AspectBindingReader from a JavaProject to its RequiredPluginsClasspathContainer,
+	 * and pass aspect binding data from the reader to individual classpath entries having a 
+	 * originBaseBundle attribute.
+	 */
+	@SuppressWarnings("decapsulation") // base class is final
+	protected class JavaCore playedBy JavaCore 
+	{
+		IClasspathAttribute newClasspathAttribute(String name, String value) -> IClasspathAttribute newClasspathAttribute(String name, String value);
+		
+// (see TODO above) Attention: 
+// this solution would require partial array lifting if an element throws LiftingVetoException:
+//		void setClasspathContainer(OTEquinoxProject[] javaProjects, IClasspathContainer[] container) 
+		void setClasspathContainer(IJavaProject[] javaProjects, IClasspathContainer[] containers) 
+		<- before void setClasspathContainer(IPath container, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor pm)
+		   with { javaProjects <- affectedProjects, 
+			      containers   <- respectiveContainers
+		   }
+//		static void setClasspathContainer(OTEquinoxProject[] javaProject, IClasspathContainer[] container) 
+		static void setClasspathContainer(IJavaProject[] javaProjects, IClasspathContainer[] containers) 
+		{
+			try {
+				for (int i=0; i<javaProjects.length; i++) {
+					Project project= (Project)javaProjects[i].getProject();
+					if (   containers[i] != null
+						&& REQUIRED_PLUGINS_CONTAINER_PATH.equals(containers[i].getPath())
+						&& ProjectUtil.isOTPluginProject(project)) // avoid LiftingVetoException
+					{
+						AspectBindingReader aspectBindingReader = ResourceProjectAdaptor.getDefault().getAspectBindingReader(project);
+						if (PDEAdaptor.instance != null)
+							//otherwise PDEAdaptor has not been activated yet (PDE neither) hoping this can be ignored.
+							PDEAdaptor.instance.setAspectBindingReader(aspectBindingReader, (RequiredPluginsClasspathContainer)containers[i]);
+						else
+							org.eclipse.jdt.core.JavaCore.getJavaCore().getLog().log(new Status(Status.WARNING, "org.eclipse.objectteams.otdt.internal.compiler.adaptor",  //$NON-NLS-1$
+																				     "PDEAdaptor not yet initialized while setting classpath for "+project.getName())); //$NON-NLS-1$
+					}
+				}
+			} catch (LiftingVetoException lve) {
+				// ignore, aspect just didn't apply
+			} catch (Throwable t) {
+				org.eclipse.jdt.core.JavaCore.getJavaCore().getLog().log(new Status(Status.ERROR, "org.eclipse.objectteams.otdt.internal.compiler.adaptor", "Error initializing AspectBindingReader", t)); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}
+		
+		void addBaseBundleAttribute(IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes) 
+			<- replace IClasspathEntry newLibraryEntry(IPath path1, IPath path2, IPath path3, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported)
+			when (accessRules != null && accessRules.length > 0)
+			with { accessRules <- accessRules, extraAttributes <- extraAttributes }
+
+		void addBaseBundleAttribute(IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes) 
+			<- replace IClasspathEntry newProjectEntry(IPath path, IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes, boolean isExported)
+			when (accessRules != null && accessRules.length > 0)
+			with { accessRules <- accessRules, extraAttributes <- extraAttributes }
+
+		/**
+		 * when creating a new classpath entry for a require plugin, check whether this plugin is affected by aspect bindings.
+		 * If so, add a classpath attribute to denote the base plugin from which this entry originates.
+		 * If a package is split among several plugins, a rule may carry one aspectBindingData for each part of the split.
+		 */
+		static callin void addBaseBundleAttribute(IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes) {
+			if (accessRules[0] instanceof ClasspathAccessRule) {
+				Object[] datas = ((ClasspathAccessRule)accessRules[0]).aspectBindingData;
+				int i = 0;
+				if (datas != null)
+					for (Object data : datas)
+						if (data instanceof AdaptedBaseBundle) {
+							// note: more than one data is rather infrequent, no need to optimize array copying
+							int len = extraAttributes.length;
+							System.arraycopy(extraAttributes, 0, extraAttributes=new IClasspathAttribute[len+1], 1, len);
+							String baseBundleName = ((AdaptedBaseBundle) data).getSymbolicName();
+							extraAttributes[0] = newClasspathAttribute(CPENTRY_ATTR_ORIGIN_BASE_BUNDLE+(i++), baseBundleName);
+						}
+			}
+			base.addBaseBundleAttribute(accessRules, extraAttributes);
+		}		
+	}
+
+	/** 
+	 * When a JavaProject computes its package fragment roots from its classpath entries,
+	 * enhance the classpath entries with aspect binding data, using the classpath attribute
+	 * to determine the corresponding base bundle.
+	 * 
+	 * @author stephan
+	 * @since 1.2.5
+	 */
+	protected class CPEntryEnhancer playedBy JavaProject {
+
+		IProject getProject() -> IProject getProject();
+
+		@SuppressWarnings("rawtypes")
+		void enhanceCPEntry(IClasspathEntry[] resolvedEntries) 
+			<- before void computePackageFragmentRoots(IClasspathEntry[] resolvedEntries, ObjectVector accumulatedRoots,
+													   HashSet rootIDs, IClasspathEntry referringEntry,
+													   boolean retrieveExportedRoots, Map rootToResolvedEntries);
+
+		/**
+		 * @param entry the entry to enhance
+		 * @throws LiftingVetoException when the project is not an OT/Equinox project.
+		 */
+		void enhanceCPEntry(IClasspathEntry[] entries) throws LiftingVetoException 
+		{
+			IProject project = getProject();
+			AspectBindingReader reader = ResourceProjectAdaptor.getDefault().getAspectBindingReader((Project)project);
+			for (IClasspathEntry entry : entries) {
+				IClasspathAttribute[] attributes = entry.getExtraAttributes();
+				attributes_loop:
+				for (IClasspathAttribute attribute : attributes) {
+					if (attribute.getName().startsWith(CPENTRY_ATTR_ORIGIN_BASE_BUNDLE)) {
+						AdaptedBaseBundle aspectBindingData = reader.getAdaptationInfo(attribute.getValue());
+						if (aspectBindingData == null) continue; // means reader and attr are inconsistent
+						rules_loop:
+						for (IAccessRule rule : entry.getAccessRules())
+							if (rule instanceof ClasspathAccessRule) 
+								if (!PDEAdaptor.addAspectBindingData((ClasspathAccessRule)rule, aspectBindingData))
+									break rules_loop; // when not adding assume all rules share the same aspect data
+						break attributes_loop;
+					}
+				}
+			}
+		}
+	}
+	
+	/** 
+	 * Interface to the controlling builder. Tasks:
+	 * <ul>
+	 * <li>Life-cycle management for the BuildManager</li>
+	 * <li>cflow like bracket [initializeBuilder,cleanup] 
+	 *     for temporary activation of BaseImportChecker.
+	 *     Note, that build() is not a suitable join point, 
+	 *     because javaProject is not yes assigned.</li>     
+	 * </ul>
+	 */
+	protected class JavaBuilderObserver playedBy JavaBuilder 
+	{	
+		@SuppressWarnings("decapsulation")
+		Project getProject() -> get JavaProject javaProject
+			with { result <- (Project)javaProject.getProject() }
+		
+		Team projectWatcher= null;
+		
+		// initialize local data structures when a full build is started: 
+		void initialize(int kind) <- after int initializeBuilder(int kind, boolean forBuild);
+		void initialize(int kind) {
+			if (kind == FULL_BUILD)
+				manager.initializeDependencyStorage();
+			try {
+				this.projectWatcher= ResourceProjectAdaptor.getDefault().getChecker(getProject());
+			} catch (LiftingVetoException lve) {
+				this.projectWatcher= new PlainProjectWatcher();
+			}
+			this.projectWatcher.activate();
+		}
+		
+		cleanup <- after cleanup;
+		void cleanup() {
+			if (this.projectWatcher != null)
+				this.projectWatcher.deactivate();
+			this.projectWatcher= null;
+		}
+		
+		// need to recompute the classpath if aspect binding data have changed:
+		@SuppressWarnings("decapsulation")
+		boolean aspectBindingHasChanged() <- replace boolean hasClasspathChanged();
+		@SuppressWarnings("basecall")
+		callin boolean aspectBindingHasChanged() {
+			try {
+				if (ResourceProjectAdaptor.getDefault().hasAspectDataChanged(getProject()))
+					return true;
+			} catch (LiftingVetoException lve) {
+				// thrown while lifting project, means that javaProject is not OT-Project.
+			}
+			return base.aspectBindingHasChanged();
+		}
+
+	}
+
+	/** 
+	 * This role observes another entry into the compiler to activate a BaseImportChecker if needed.
+	 */
+	protected class CompilationUnitProblemFinder playedBy CompilationUnitProblemFinder 
+	{
+		@SuppressWarnings("rawtypes")
+		void activateChecker(ICompilationUnit unitElement)
+		<- replace CompilationUnitDeclaration process(CompilationUnit unitElement, 
+													  SourceElementParser parser,
+													  WorkingCopyOwner workingCopyOwner,
+													  HashMap problems,
+													  boolean creatingAST,
+													  int reconcileFlags,
+													  IProgressMonitor monitor)
+			with { unitElement <- unitElement }
+	
+		static callin void activateChecker(ICompilationUnit unitElement)
+				throws JavaModelException
+		{	
+			within (getChecker(unitElement)) 
+			 	base.activateChecker(unitElement);
+		}
+
+		static Team getChecker(ICompilationUnit unitElement) {			
+			try {
+				Project project= ProjectUtil.safeGetOTPluginProject(unitElement);
+				if (project != null) {
+					Team baseChecker= ResourceProjectAdaptor.getDefault().getChecker(project);
+					if (baseChecker != null)
+						return baseChecker;
+				}
+			} catch (LiftingVetoException lve) {
+				// shouldn't happen, have checked above.
+			}
+			return new PlainProjectWatcher(); // fallback for non OT-Plugin projects
+		}
+	}
+
+	private BuildManager manager = new BuildManager();
+	
+	/**
+	 * This role observes the IncrementalImageBuilder.
+	 * It enables all callins of BuildManager only while 
+	 * performing an incremental build (method build(deltas)). 
+	 */
+	protected class BuilderGuard playedBy IncrementalImageBuilder 
+	{
+		build <- replace build;
+		callin boolean build(SimpleLookupTable deltas) 
+		{
+			// Activation only for this thread/control flow:
+			within (manager) {
+				return base.build(deltas);
+			}
+		}
+	}
+	
+	/**
+	 * This role class simply tracks all executions of CopyInheritance.copyRole(..)
+	 * 
+	 * Purpose: collect data for recompiling sub-teams if tsuper roles have been changed.
+	 */
+	protected class CopyInheritanceObserver playedBy CopyInheritance 
+	{
+		// This trigger applies to source and binary tsupers being copied into source:
+		void observeCopyRole(ReferenceBinding superRole, char[] subTeamFileName)
+			<- after TypeDeclaration copyRole(ReferenceBinding tsuperRole, 
+											  boolean isNestedType, 
+							                  TypeDeclaration subTeamDecl, 
+							                  boolean isTsuperTeam)
+		base when (result != null)
+		with  { superRole       <- tsuperRole, 
+		        subTeamFileName <- subTeamDecl.compilationResult.getFileName() }
+
+		// static for optimization: avoid lifting.
+		static void observeCopyRole(ReferenceBinding superRole, char[] subTeamFileName) 
+		{
+			if (superRole.enclosingType().id == IOTConstants.T_OrgObjectTeamsTeam)
+				return;
+			if (subTeamFileName == null || subTeamFileName[0] != '/')
+				return; // only useful if an absolute path is given.
+			
+			// no need to recompile these: 
+			char[] superRoleName = superRole.internalName();
+			if (   BuildManager.isPredefinedRole(superRoleName) 
+				|| OTNameUtils.isTSuperMarkerInterface(superRoleName))
+				return;
+			AdaptorActivator.this.manager.recordCopiedRole(superRole.attributeName(), subTeamFileName); 
+		}
+		
+		@SuppressWarnings("decapsulation")
+		boolean shouldPreserveBinary(ReferenceBinding role, CompilationResult cResult) 
+			<-replace boolean shouldPreserveBinaryRole(ReferenceBinding role, CompilationResult cResult);
+		static callin boolean shouldPreserveBinary(ReferenceBinding role, CompilationResult cResult) 
+		{
+			if (!base.shouldPreserveBinary(role, cResult))
+				return false;
+			if (!AdaptorActivator.this.manager.isActive())
+				return true;
+			return AdaptorActivator.this.manager.shouldPreserveBinaryRole(role, cResult);
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AspectBindingReader.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AspectBindingReader.java
new file mode 100644
index 0000000..bae44d0
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/AspectBindingReader.java
@@ -0,0 +1,364 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: AspectBindingReader.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+import org.eclipse.pde.core.build.IBuild;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.internal.core.ClasspathUtilCore;
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.pde.internal.core.PluginModelManager;
+import org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer;
+import org.objectteams.LiftingVetoException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Utility to read the aspectBinding extension from a projects plugin.xml,
+ * in order to provide this information during compilation.
+ * 
+ * References to an AspectBindingReader are passed along the full information flow
+ * from PDEAdaptor to BaseImportChecker as a source for fetching aspect binding information.
+ * 
+ * @author stephan
+ * @since 1.1.5
+ */
+@SuppressWarnings("restriction")
+public class AspectBindingReader {
+
+	// XML-Structure of aspectBindings in plugin.xml:
+	private final static String ASPECT_BINDING       = "aspectBinding";     //$NON-NLS-1$
+	private final static String    BASE_PLUGIN       = "basePlugin";        //$NON-NLS-1$
+	private final static String       ID             = "id"; //attribute    //$NON-NLS-1$
+	private final static String       FORCED_EXPORTS = "forcedExports";     //$NON-NLS-1$
+	private final static String    TEAM              = "team";              //$NON-NLS-1$
+	private final static String       CLASS          = "class"; //attribute //$NON-NLS-1$
+	
+	private static final String SELF                 = "SELF";  //value     //$NON-NLS-1$
+	// Note: we do NOT read the requiredFragment element, because when creating access rules
+	//       the packages of the fragment will report the host bundle as their providingBundle.
+	//       (see PDEAdaptor.RequiredPluginsClasspathContainer#updateRule())
+	
+	private static SAXParserFactory fSAXFactory;
+	
+	// == local cached storage: ==
+	
+	// main date storage: teamClassName -> basePluginName* 
+	private HashMap<String, HashSet<String>> team2basePlugins = null;
+	
+	private HashMap<String, HashSet<String>> base2forcedExports = null;
+	private HashSet<String> teamsAdaptingSelf= new HashSet<String>();
+	
+	// reverse info with more details: basePluginName -> AdaptedBaseBundle
+	private HashMap<String, AdaptedBaseBundle> adaptationInfos= new HashMap<String, AdaptedBaseBundle>();
+	
+	private String project;
+	private IProject iProject;
+	
+	/** This field serves as a time stamp to track whether an
+	 * aspect binding reader has been reloaded. */
+	Object token;
+
+	private boolean hasChanges;
+	
+	// for accessing objects of type IPluginModelBase:
+	PluginModelManager fPluginModelManager;
+
+	/**
+	 * Create and initialize an AspectBindingReader, i.e., try to read aspect binding info from the project's plugin.xml.
+	 * 
+	 * @param project the project whose aspect bindings should be analyzed.
+	 * @throws LiftingVetoException  if the project was not ready for reading plugin.xml.
+	 */
+	public AspectBindingReader(IProject project) throws LiftingVetoException {
+		if (!this.readAspectBindings(project, getSaxParserFactory()))
+			throw new LiftingVetoException();
+		this.project= project.getName();
+		this.iProject= project;
+		this.fPluginModelManager = PDECore.getDefault().getModelManager();
+	}
+
+	/** Is the given team declared to adapt classes from its own plug-in ("self")? */
+	public boolean isAdaptingSelf(String teamName) {
+		return this.teamsAdaptingSelf.contains(teamName);
+	}
+
+	/** Get the base plug-in adapted by the given team. */
+	public Set<String> getBasePlugins(String teamName) {
+		if (this.team2basePlugins != null)
+			return this.team2basePlugins.get(teamName);
+		return null;
+	}
+	
+	/** Is the bundle identified by this symbolic name an adapted base bundle.? */
+	public boolean isAdaptedBase(String symbolicName) {
+		return this.adaptationInfos.containsKey(symbolicName);
+	}
+	
+	/** Get the names of all teams that adapt the given base bundle. */
+	public Set<String> getTeamsForBase(String basePluginName) {
+		AdaptedBaseBundle info = this.adaptationInfos.get(basePluginName);
+		if (info == null) 
+			return new HashSet<String>();
+		return info.adaptingTeams;
+	}
+
+	/** Get (lazily create) the detailed info for an adapted base bundle. */
+	public AdaptedBaseBundle getAdaptationInfo(String basePluginName) {
+		AdaptedBaseBundle result= this.adaptationInfos.get(basePluginName);
+		if (result == null) {
+			result= new AdaptedBaseBundle(basePluginName, this);
+			this.adaptationInfos.put(basePluginName, result);
+		}
+		return result;
+	}
+
+
+	/** Is the given package force-exported? */
+	public String getForcedExportingBase(String packageName) {
+		if (this.base2forcedExports == null)
+			return null;
+		for (Entry<String, HashSet<String>> entry: this.base2forcedExports.entrySet()) {
+			if (entry.getValue().contains(packageName))
+				return entry.getKey();
+		}
+		return null;
+	}
+
+	public HashSet<String> getForcedExports(String symbolicName) {
+		if (this.base2forcedExports == null)
+			return null;
+		return this.base2forcedExports.get(symbolicName);
+	}
+
+	static SAXParserFactory getSaxParserFactory() {
+		if (fSAXFactory == null) 
+			fSAXFactory = SAXParserFactory.newInstance();
+		return fSAXFactory;
+	}
+	
+
+	/** Read all the <aspectBinding> declarations from plugin.xml. 
+	 * @return whether or not reading plugin.xml was successful.
+	 */ 
+	private boolean readAspectBindings (IProject project, SAXParserFactory factory)  {
+		SAXParser parser;
+		try {
+			parser = factory.newSAXParser();
+			IFile file = project.getFile("plugin.xml"); //$NON-NLS-1$
+			if (!file.exists())
+				return false;
+			collectAspectBindings(file, parser);
+			this.token= new Object();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return true;
+	}
+	
+	/** Stage 1: remember which team declares to adapt classes from which base plug-in. */
+	void recordAspectBinding(String teamClass, String basePluginID) {
+		if (SELF.equals(basePluginID.toUpperCase())) {
+			this.teamsAdaptingSelf.add(teamClass);
+			return;
+		}
+		if (this.team2basePlugins == null)
+			this.team2basePlugins = new HashMap<String, HashSet<String>>();
+		HashSet<String> plugins = this.team2basePlugins.get(teamClass);
+		if (plugins == null) {
+			plugins = new HashSet<String>();
+			this.team2basePlugins.put(teamClass, plugins);
+		}
+		plugins.add(basePluginID);
+		
+		// and store detailed reverse info:
+		AdaptedBaseBundle adaptationInfo = getAdaptationInfo(basePluginID);
+		adaptationInfo.adaptingTeams.add(teamClass);
+	}
+
+	void recordForcedExports(String basePlugin, String exports) {
+		if (this.base2forcedExports == null) 
+			this.base2forcedExports= new HashMap<String, HashSet<String>>();
+		HashSet<String> baseExports= this.base2forcedExports.get(basePlugin);
+		if (baseExports == null) 
+			this.base2forcedExports.put(basePlugin, baseExports= new HashSet<String>());
+		String[] singleExports= exports.split(","); //$NON-NLS-1$
+		for (int i = 0; i < singleExports.length; i++)
+			baseExports.add(singleExports[i].trim());
+		// TODO(SH): not yet checked: are the exports really packages of basePlugin?
+	}
+
+	void collectAspectBindings(IFile file, SAXParser parser) {
+		try {
+			parser.parse(file.getContents(), new DefaultHandler() {
+				String basePluginID = null;
+				ArrayList<String> teamClasses = null;
+				StringBuffer forcedExports= null;
+				@Override
+				public void startElement(String uri, String localName, String name, Attributes attributes) 
+						throws SAXException 
+				{
+					if (name.equals(ASPECT_BINDING)) 
+						this.teamClasses = new ArrayList<String>();
+					else if (this.teamClasses != null) { // within an aspectBinding element?
+						if (name.equals(BASE_PLUGIN)) {
+							this.basePluginID = attributes.getValue(ID);
+						} else if (name.equals(TEAM)) {                  
+							String teamClass = attributes.getValue(CLASS);
+							if (teamClass == null)
+								throw new SAXException("team element lacking \"class\" attribute"); //$NON-NLS-1$
+							this.teamClasses.add(teamClass);
+						} else if (name.equals(FORCED_EXPORTS)) {
+							this.forcedExports= new StringBuffer();
+						}
+					}
+				}
+				@Override
+				public void characters(char[] ch, int start, int length) throws SAXException 
+				{
+					if (this.forcedExports != null)
+						this.forcedExports.append(ch, start, length);
+				}
+				@Override
+				public void endElement(String uri, String localName, String name)
+						throws SAXException 
+				{
+					if (name.equals(ASPECT_BINDING)) {
+						if (this.basePluginID == null)
+							throw new SAXException("aspectBinding missing a \"basePlugin\" element"); //$NON-NLS-1$
+						for (String	teamClass : this.teamClasses) 
+							recordAspectBinding(teamClass, this.basePluginID);
+						this.basePluginID = null;
+						this.teamClasses = null;
+					} else if (name.equals(FORCED_EXPORTS)) {
+						if (this.forcedExports != null && this.forcedExports.length() > 0)
+							recordForcedExports(this.basePluginID, this.forcedExports.toString());
+						this.forcedExports= null;
+					}
+				}
+			});
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}	
+	}
+	// ===== Below: Updating. =====
+
+	/** When plugin.xml has changed re-read our data and perhaps clear
+	 *  cached data in the JavaModelManager and RequirePluginsClasspathContainer. */
+	void reload() {
+		this.hasChanges= true;
+		
+		HashMap<String,HashSet<String>> oldForcedExports= this.base2forcedExports;
+		HashMap<String,HashSet<String>> oldTeamBindings= this.team2basePlugins;
+		// clear internal storage:
+		this.team2basePlugins = null;   // be sure to initialize new sets if needed, so we can compare sets using mapHasChanged
+		this.base2forcedExports = null;
+		this.adaptationInfos.clear();   // these two are created by default (and no need to compare old/new)
+		this.teamsAdaptingSelf.clear();
+		
+		if (!this.readAspectBindings(this.iProject, getSaxParserFactory())) {
+			OTDTPlugin.getDefault().getLog().log(new Status(Status.ERROR, OTDTPlugin.PLUGIN_ID, "Unable to re-read plugin.xml!;")); //$NON-NLS-1$
+			return ;
+		}
+		
+		// remove cached data if forced exports or team bindings have changed:
+		if (   mapHasChanged(oldForcedExports, this.base2forcedExports)
+		    || mapHasChanged(oldTeamBindings,  this.team2basePlugins)) 
+		{
+			resetRequiredPluginsClasspathContainer(this.iProject);
+		}
+	}
+	
+	/** Destructively read the flag indicating changed aspect binding data. */
+	boolean fetchHasChanges() {
+		try {
+			return this.hasChanges;
+		} finally {
+			this.hasChanges= false;
+		}
+	}
+	
+	private void resetRequiredPluginsClasspathContainer(IProject project) {
+		IJavaProject jProject = JavaCore.create(project);
+		IPluginModelBase model = fPluginModelManager.findModel(project);
+		try {
+			IBuild build = ClasspathUtilCore.getBuild(model);
+			RequiredPluginsClasspathContainer container = new RequiredPluginsClasspathContainer(model, build);
+			// this triggers recomputing the classpath:
+			JavaCore.setClasspathContainer(PDECore.REQUIRED_PLUGINS_CONTAINER_PATH, new IJavaProject[]{jProject}, new IClasspathContainer[] {container}, null);
+			// AspectBindingReader is automatically shared via the ResourceProjectAdaptor.OTEquinoxProject
+			// see org.eclipse.objectteams.otdt.internal.compiler.adaptor.AdaptorActivator.JavaCore.setClasspathContainer(..)
+		} catch (CoreException ce) {
+			OTDTPlugin.getExceptionHandler().logException("Failed to reload classpath container for "+project, ce); //$NON-NLS-1$
+		}
+	}
+
+	private <T> boolean mapHasChanged(HashMap<String,T> oldMap, 
+									  HashMap<String,T> newMap) 
+	{
+		if (oldMap == null || newMap== null)
+			return oldMap != newMap; // null and non-null?
+		HashSet<String> newKeys= new HashSet<String>(newMap.keySet());
+		for (Map.Entry<String, T> oldEntry : oldMap.entrySet()) {
+			T newVal= newMap.get(oldEntry.getKey());
+			if (newVal == null)
+				return true;       // removed entry
+			if (!newVal.equals(oldEntry.getValue()))
+				return true;	   // changed value (simple or complex)
+			newKeys.remove(oldEntry.getKey());
+		}
+		return !newKeys.isEmpty(); // added entries in newKeys?		
+	}
+	
+	// ===== Debug: =====
+	@SuppressWarnings("nls")
+	@Override
+	public String toString() {
+		String result= "AspectBindingReader for project "+this.project;
+		if (this.team2basePlugins != null)
+			result+= "\n\t known teams: "+this.team2basePlugins.size();
+		if (this.teamsAdaptingSelf != null)
+			result+= "\n\t self-adaption teams: "+this.teamsAdaptingSelf.size();
+		if (this.base2forcedExports != null)
+			result+= "\n\t plugins with forced exports: "+this.base2forcedExports.size();
+		return result;
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
new file mode 100644
index 0000000..c8f33cf
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
@@ -0,0 +1,289 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: BaseImportChecker.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Expression;
+import org.eclipse.jdt.internal.compiler.ast.ImportReference;
+import org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Expression.DecapsulationState;
+import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
+import org.eclipse.jdt.internal.compiler.env.AccessRule;
+import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
+import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ImportBinding;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.objectteams.otdt.core.exceptions.InternalCompilerError;
+
+import base org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
+import base org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
+
+/**
+ * This team checks whether base-imports are backed up by proper aspectBinding declarations.
+ * (Only activated if the project has the PluginNature).
+ * This team is only temporarily instantiated/activated by AdaptorActivator.JavaProject(JavaProject).
+ * 
+ * This team also handles the forcedExport declarations from aspectBindings extensions
+ * and correspondingly converts some diagnostics from forbiddenAccess to decapsulationByForcedExport.
+ * 
+ * Other parts involved:
+ * 
+ *  + PDEAdaptor is responsible for adding aspectBindingData (of type AdaptedBaseBundle) 
+ *    to ClasspathAccessRules and adjusting the problemID
+ *  
+ *  + org.eclipse.jdt.internal.core.builder.NameEnvironment
+ *    - computeClasspathLocations(IWorkspaceRoot, JavaProject, SimpleLookupTable)
+ *    Feed AccessRuleSet from ClasspathEntry into ClasspathLocations like ClasspathDirectory.
+ *     
+ *  + org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment
+ *    - setAccessRestriction(ReferenceBinding, AccessRestriction)
+ *    - AccessRestriction getAccessRestriction(TypeBinding type)
+ *    Pass AccessRestriction from sources like ClasspathDirectory.accessRuleSet into the compiler. 
+ * 
+ * @author stephan
+ * @since 1.1.2
+ */
+@SuppressWarnings("restriction")
+public team class BaseImportChecker extends CompilationThreadWatcher
+{
+	private AspectBindingReader aspectBindingReader;
+	
+	public BaseImportChecker() {/* emtpy ctor for OT/Equinox */ }
+	
+	/**
+	 * @param aspectBindingReader must be non-null (and initialized). 
+	 */
+	public BaseImportChecker(AspectBindingReader aspectBindingReader) {
+		this.aspectBindingReader= aspectBindingReader;
+	}
+
+	/**
+	 * If a forced exports exist convert some diagnostics from forbiddenAccess 
+	 * to decapsulationByForcedExport.
+	 */
+	protected class ProblemReporter playedBy ProblemReporter 
+	{   
+		// imports via callout:
+		protected void baseImportInRegularClass(TypeDeclaration firstType, ImportReference reference) 
+			-> void baseImportInRegularClass(TypeDeclaration firstType, ImportReference reference);
+		protected void illegalBaseImportNoAspectBinding(ImportReference ref, String teamName) 
+			-> void illegalBaseImportNoAspectBinding(ImportReference ref, String teamName);
+		protected void illegalBaseImport(ImportReference ref, String expectedBasePlugin, String actualBasePlugin) 
+			-> void illegalBaseImport(ImportReference ref, String expectedBasePlugin, String actualBasePlugin);
+		void illegalUseOfForcedExport(ReferenceBinding type, ASTNode reference) 
+			-> void illegalUseOfForcedExport(ReferenceBinding type, ASTNode reference);
+		void decapsulationByForcedExport(ReferenceBinding type, ASTNode reference) 
+			-> void decapsulationByForcedExport(ReferenceBinding type, ASTNode reference);
+		void baseImportFromSplitPackage(ImportReference ref, String expectedPlugin)
+		    -> void baseImportFromSplitPackage(ImportReference ref, String expectedPlugin);
+		
+
+		ReferenceContext getReferenceContext() -> get ReferenceContext referenceContext;
+		
+		/** The callin entry into this role: analyze and report various access situations. */
+		@SuppressWarnings("basecall")
+		callin void forbiddenReference(TypeBinding type, ASTNode location, AccessRestriction restriction) 
+		{
+			switch (restriction.getProblemId()) {
+			case IProblem.BaseclassDecapsulationForcedExport:
+				switch (getBaseclassDecapsulation(location)) {
+				case ALLOWED:
+					decapsulationByForcedExport((ReferenceBinding)type, location);
+				case REPORTED:
+					break;
+				default:
+					// no forced export for regular use!
+					illegalUseOfForcedExport((ReferenceBinding)type, location);
+				}
+				break;
+			case IProblem.AdaptedPluginAccess: 
+				// not a real error but requires consistency check against aspectBinding:
+				if (location instanceof ImportReference) {
+					ImportReference imp= (ImportReference)location;
+					if (imp.isBase()) {
+						String teamName= getReferenceTeam();
+						if (teamName == null) 
+							baseImportInRegularClass(getPublicType(), imp);
+						
+						Set<String> basePlugins= aspectBindingReader.getBasePlugins(teamName);
+						if (basePlugins == null || basePlugins.isEmpty()) {
+							illegalBaseImportNoAspectBinding(imp, teamName);
+							return;
+						}
+						String baseString = flattenSet(basePlugins);
+						Set<String> actualBases = new HashSet<String>();
+						AccessRule rule= restriction.getAccessRule();
+						if (rule.aspectBindingData != null) {
+							for (Object data : rule.aspectBindingData) {
+								AdaptedBaseBundle info= (AdaptedBaseBundle) data;
+								if (info.isAdaptedBy(teamName)) {
+									// OK, no error
+									if (info.hasPackageSplit)
+										baseImportFromSplitPackage(imp, baseString); // just a warning
+									return;
+								}
+								actualBases.add(info.getSymbolicName());
+							}
+						}
+						illegalBaseImport(imp, baseString, flattenSet(actualBases));
+					}
+				}
+				break;
+			default:
+				base.forbiddenReference(type, location, restriction);
+			}
+		}
+		void forbiddenReference(TypeBinding type, ASTNode location, AccessRestriction restriction)
+		<- replace void forbiddenReference(TypeBinding type, ASTNode location, byte entryType, AccessRestriction restriction)
+		   with { type <- type, location <- location, restriction <- restriction }
+
+		void forbiddenReference(TypeBinding type, ASTNode location, AccessRestriction restriction) 
+		<- replace void forbiddenReference(MethodBinding method, ASTNode location, byte entryType, AccessRestriction restriction)
+		   with { type <- method.declaringClass, location <- location, restriction <- restriction }
+
+		void forbiddenReference(TypeBinding type, ASTNode location, AccessRestriction restriction) 
+		<- replace void forbiddenReference(FieldBinding field, ASTNode location, byte entryType, AccessRestriction restriction)
+		   with { type <- field.declaringClass, location <- location, restriction <- restriction }
+
+		
+		private DecapsulationState getBaseclassDecapsulation(ASTNode location) {
+			if (location instanceof Expression) {
+				if (location instanceof AllocationExpression)
+					return DecapsulationState.REPORTED; // base-ctor expression.
+				if (location instanceof MessageSend)
+					return DecapsulationState.REPORTED; // callout message send.
+				Expression expr= (Expression) location;
+				DecapsulationState result= expr.getBaseclassDecapsulation();
+				if (result == DecapsulationState.ALLOWED)
+					expr.tagReportedBaseclassDecapsulation();
+				return result;
+			} 
+			if (location instanceof ImportReference) {
+				ImportReference impRef= (ImportReference)location;
+				if (impRef.isBase())
+					return DecapsulationState.ALLOWED; // always need to report 
+			}
+			return DecapsulationState.NONE;
+		}
+		private String getReferenceTeam() {
+			TypeDeclaration type= getPublicType();
+			if (type != null && type.isTeam())
+				return new String(type.binding.readableName());
+			return null;
+		}
+		private TypeDeclaration getPublicType() {
+			ReferenceContext context= getReferenceContext();
+			if (context instanceof CompilationUnitDeclaration) {
+				CompilationUnitDeclaration unit= (CompilationUnitDeclaration)context;
+				if (unit.types == null) return null;
+				for (TypeDeclaration type : unit.types)
+					if (Flags.isPublic(type.modifiers))
+						return type;
+			}
+			return null;
+		}
+	}
+	
+	
+	protected class ImportTracker playedBy CompilationUnitScope
+	{
+		ReferenceBinding[] getTopLevelTypes() -> get ReferenceBinding[] topLevelTypes;
+	  private // don't publically expose protected role ProblemReporter
+		ProblemReporter    problemReporter()  ->     ProblemReporter    problemReporter();
+
+		/** When setting the base imports to a CUScope, check for imports from undeclared plug-ins. */
+		void setBaseImports(ImportBinding[] resolvedBaseImports, int baseCount, ImportReference[] refs) 
+		<- before void setBaseImports(ImportBinding[] resolvedBaseImports, int baseCount, ImportReference[] refs);
+		void setBaseImports(ImportBinding[] resolvedBaseImports, int baseCount, ImportReference[] refs) 
+		{
+			if (baseCount == 0) return;
+			ReferenceBinding teamType = findMainType();
+			String teamName= (teamType != null)
+								? new String(teamType.readableName()) : null;
+			for (int i=0; i<baseCount; i++) {
+				if (teamType == null) {
+					problemReporter().baseImportInRegularClass(null, refs[i]);
+					continue;
+				}
+				if (resolvedBaseImports[i].onDemand) // syntactically impossible
+					throw new InternalCompilerError("Ondemand base import not supported");  //$NON-NLS-1$
+				String basePlugins= null;
+				if (resolvedBaseImports[i].resolvedImport instanceof ReferenceBinding) {
+					ReferenceBinding importedType= (ReferenceBinding)resolvedBaseImports[i].resolvedImport;
+					if (!importedType.isValidBinding())
+						continue; // already reported
+					if (importedType.hasRestrictedAccess())
+						continue; // checked by forbiddenAccess()
+					if (aspectBindingReader.isAdaptingSelf(teamName)) {
+						char[][] current= CharOperation.splitOn('/', teamType.getFileName());
+						char[][] imported= CharOperation.splitOn('/', importedType.getFileName());
+						if (CharOperation.equals(current[1], imported[1]))
+							return;
+						basePlugins= "<self>"; //$NON-NLS-1$
+					}
+				}
+				if (basePlugins == null)
+					basePlugins= flattenSet(aspectBindingReader.getBasePlugins(teamName));
+				if (basePlugins != null)
+					problemReporter().illegalBaseImport(refs[i], basePlugins, null);
+				else
+					problemReporter().illegalBaseImportNoAspectBinding(refs[i], teamName);
+			}
+		}
+		private ReferenceBinding findMainType() {
+			ReferenceBinding[] toplevelTypes = getTopLevelTypes();
+			if (toplevelTypes != null)
+				for (ReferenceBinding referenceBinding : toplevelTypes) 
+					if (referenceBinding.isPublic())
+						return referenceBinding;
+
+			return null;
+		}
+	}
+	@SuppressWarnings("nls")
+	String flattenSet(Set<String> stringSet) {
+		if (stringSet == null) return null;
+		Iterator<String> iterator = stringSet.iterator();
+		if (stringSet.size()==1) {
+			return iterator.next();
+		} else {
+			String result = "[";
+			while(true) {
+				result += iterator.next();
+				if (!iterator.hasNext()) break;
+				result += ", ";
+			}
+			return result + "]";
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager.java
new file mode 100644
index 0000000..6be0534
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager.java
@@ -0,0 +1,345 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: BuildManager.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+
+import base org.eclipse.jdt.core.compiler.CategorizedProblem;
+import base org.eclipse.jdt.internal.compiler.CompilationResult;
+import base org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; // base-class of a role file
+import base org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
+import base org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import base org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
+import base org.eclipse.jdt.internal.compiler.problem.AbortType;
+import base org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
+import base org.eclipse.objectteams.otdt.internal.core.compiler.lifting.LiftingEnvironment;
+import base org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder; // base-class of a role file
+
+/**
+ * This Team observes the build/compile process and advises the IncrementalImageBuilder, 
+ * when and what to recompile due to OT-specific dependencies.
+ * 
+ * @author stephan
+ * @version $Id: BuildManager.java 23451 2010-02-04 20:33:32Z stephan $
+ */
+@SuppressWarnings("restriction")
+public team class BuildManager extends CompilationThreadWatcher
+{
+	public static int DEBUG = 0; // levels: 0 nothing, 1 some, 2 more.
+
+	/** Remember the (one) ImageBuilder role. */
+	ImageBuilder builder = null;
+	
+	// ====== Data common for all roles (incl. accessors and life-cycle). ======
+	
+	
+	/** Manage cross-ref table for copied roles:
+	 *  PRODUCER: RoleCopyTracker.trackCopyRole()
+	 *  CONSUMER: ClassFileChangeTracker.nonStructuralChange()
+	 *  
+	 *  ENCODING: RoleTypeName -> Set<TeamSourceFileName> */
+	HashMap<String, Set<String>> roleToSubTeams = new HashMap<String, Set<String>>();
+	
+	void recordCopiedRole(char[] roleName, char[] subTeamSourceFileName) {
+		String roleString = new String(roleName);
+		Set<String> teams = roleToSubTeams.get(roleString);
+		if (teams == null) 
+			roleToSubTeams.put(roleString, teams = new HashSet<String>());
+		teams.add(new String(subTeamSourceFileName));
+		if (DEBUG >= 2)
+			System.out.println("role "+roleString+" is COPIED to "+new String(subTeamSourceFileName));  //$NON-NLS-1$//$NON-NLS-2$
+	}
+//	// debug helper
+//	void printCopyTable() {
+//		System.out.print("-------------------------");
+//		for (Map.Entry<String, Set<String>> entry : roleToSubTeams.entrySet()) {
+//			System.out.print("\nRole "+entry.getKey());
+//			for (String value : entry.getValue()) {
+//				System.out.print("\n\t"+value);
+//			}
+//		}
+//		System.out.println("\n-------------------------");
+//	}
+	
+	/** If a tsuper role has non-structural changes, some sub-teams need to be recompiled.
+	 *  This set holds the teams to be recompiled.
+	 *
+	 *  PRODUCERS: ClassFileChangeTracker.nonStructuralChange()
+	 *  		   ImageBuilder.shouldPreserveBinary() (during compile->finishedWith)
+	 *  CONSUMER:  ImageBuilder.addAffectedTeamFiles()
+	 *  
+	 *  ENCODING: source file name
+	 */
+	HashSet<String> teamsToRecompile = new HashSet<String>();
+	
+	/** Get and clear the set of teams waiting for recompilation. */
+	HashSet<String> fetchTeamsToRecompile() {
+		HashSet<String> result = teamsToRecompile;
+		teamsToRecompile = new HashSet<String>();
+		return result;
+	}
+
+	/** If a tsuper role has non-structural changes, some sub-teams need to be recompiled.
+	 *  This set holds the roles that should NOT be preserved.
+	 *  PRODUCER: ClassFileChangeTracker.nonStructuralChange()
+	 *  CONSUMER: shouldPreserveBinary() (via shouldCandidateBePreserved())
+	 *  
+	 *  ENCODING: Qualified Type Name. p.T$I, canonical form, i.e., __OT__ prefixes removed.
+	 */
+	HashSet<String> staleRoles = new HashSet<String>();
+
+	synchronized void initializeDependencyStorage() {
+		this.roleToSubTeams = new HashMap<String, Set<String>>();
+		this.teamsToRecompile = new HashSet<String>();
+		this.staleRoles = new HashSet<String>();
+	}
+	
+	protected class BinaryType playedBy BinaryTypeBinding 
+	{
+		/** Record if a given type depends on an unresolvable type.
+		 *  More specifically, we look for roles depending on unresolvable tsuper roles. 
+		 */
+		superInterfaces         <- replace superInterfaces;
+		callin ReferenceBinding[] superInterfaces() {
+			try { 
+				return base.superInterfaces();
+			} catch (AbortCompilation as Abort abort) {
+				abort.referencedBinaries.add(this);
+				throw abort;
+			}
+		}
+		
+		// ==== Callouts: ==== 
+				
+		char[][] compoundName() -> get char[][] compoundName;
+
+		// DEBUGGING:
+		String internalName() -> char[] internalName() 
+			with { result <- new String(result) }
+	}
+	
+	protected class ClassScope playedBy ClassScope
+	{
+		@SuppressWarnings("decapsulation")
+		void connectTypeHierarchy() <- replace void connectTypeHierarchy();
+		@SuppressWarnings("basecall")
+		callin void connectTypeHierarchy() {
+			try {
+				base.connectTypeHierarchy();
+			} catch (org.eclipse.jdt.internal.compiler.problem.AbortType at) {
+				TypeDeclaration referenceContext = referenceContext();
+				SourceTypeBinding sourceType = referenceContext.binding;
+				at.updateContext(referenceContext, referenceCompilationUnit().compilationResult);
+				referenceContext.ignoreFurtherInvestigation = true;
+				if (sourceType.superInterfaces == null)
+					sourceType.superInterfaces = TypeBinding.NO_SUPERINTERFACES; // TODO(SH): recurse?
+				// don't rethrow, marking ignoreFurtherInvestigation is enough abortion
+			}
+		}
+		TypeDeclaration referenceContext()                    -> get TypeDeclaration referenceContext;
+		CompilationUnitDeclaration referenceCompilationUnit() -> CompilationUnitDeclaration referenceCompilationUnit();
+	}
+
+	protected class LiftingEnv playedBy LiftingEnvironment 
+	{
+		callin void init(TypeDeclaration teamType) {
+			try {
+				base.init(teamType);
+			} catch (org.eclipse.jdt.internal.compiler.problem.AbortType at) {
+				teamType.ignoreFurtherInvestigation = true;
+				BuildManager.this.teamsToRecompile.add(String.valueOf(teamType.compilationResult.fileName));
+				throw at; // TODO(SH): might want to mark certain AT-instances as recoverable?
+			}
+		}
+		init <- replace init;
+	}
+	
+	/** This role helps to link Problem->Abort->BinaryType,
+	 *  in order to determine whether a problem was caused by an unresolvable tsuper role.  
+	 */
+	protected class Abort playedBy AbortCompilation 
+	{
+		public List<BinaryType> referencedBinaries = new ArrayList<BinaryType>();
+
+		/** Trigger: this role has more to be updated from the context. */
+		void updateContext(ASTNode astNode, CompileResult unitResult) 
+			<- after void updateContext(ASTNode astNode, CompilationResult unitResult);
+
+		/** 
+		 * If the current abort exception could possibly be fixed by a recompile,
+		 * + convert the exception onto a less drastic AbortType 
+		 * + record the link Problem->Abort.
+		 */
+		public void updateContext(ASTNode astNode, CompileResult unitResult) {
+			Problem problem = getProblem();
+			if (   problem != null
+				&& problem.couldBeFixedByRecompile()
+				&& unitResult.isReusingBinaryMember()) 
+			{ 
+				// convert AbortCompilation into AbortType
+				Abort abort = new AbortType(
+								new org.eclipse.jdt.internal.compiler.problem.AbortType(
+									unitResult, problem));
+				abort.referencedBinaries = this.referencedBinaries;
+				problem.abortException = abort;				
+				RuntimeException ex = abort;
+				throw ex;
+			}
+		}
+	
+		protected Problem getProblem() -> get CategorizedProblem problem;
+	}
+	
+	protected class AbortType extends Abort playedBy AbortType 
+	{
+//		// FIXME : this ctor gives a VerifyError:
+//		AbortType (CompileResult result, Problem problem) {
+//			base(result, problem);
+//			problem.abortException = this;
+//		}
+		@Override
+		public void updateContext(ASTNode astNode, CompileResult unitResult) {
+			// no super call: would cause recursive creation of roles
+			Problem problem = getProblem();
+			if (problem != null) {
+				problem.abortException = this;
+			}
+		}
+	}
+	
+	/** Intermediate purely callout role. */
+	protected class CompileResult playedBy CompilationResult
+	{
+	  protected // don't publically export protected role Problem
+		Problem[] problems()                     -> get CategorizedProblem[] problems;
+		
+		// TODO(SH): workaround for lowering problem concerning base call in ImageBuilder.shouldPreserveBinary() 
+		boolean hasBinaryMember(char[] typeName) ->     boolean hasBinaryMember(char[] typeName);
+		
+		@SuppressWarnings({"decapsulation", "unchecked"})
+	  protected
+		boolean isReusingBinaryMember() 		 -> get ArrayList binaryMemberNames
+			with { result <- !(result == null || result.isEmpty()) }
+		
+		char[] getFileName() -> char[] getFileName();
+		// debugging:
+		toString => toString;
+	}
+	
+	/** Let a problem know about the associated exception. */
+	protected class Problem playedBy CategorizedProblem 
+	{
+		public Abort abortException = null;
+		public char[] typeToRemove= null;
+	
+		/** Certain problem reasons might be fixed by recompilation. */
+		protected boolean couldBeFixedByRecompile() {
+			switch (getID()) {
+			case IProblem.IsClassPathCorrect:
+			case IProblem.StaleTSuperRole:
+			case IProblem.StaleSubRole:
+			case IProblem.MissingRoleInBinaryTeam:
+			case IProblem.RoleFileInBinaryTeam:
+			case IProblem.CorruptBytecode:
+			case IProblem.MissingAccessorInBinary:
+			case IProblem.MismatchingRoleParts:
+			case IProblem.InconsistentlyResolvedRole:
+			case IProblem.NotGeneratingCallinBinding:
+				return true;
+			default:
+				return false;
+			}
+		}
+		
+		int getID() -> int getID();
+		// debugging:
+		toString => getMessage;
+	}
+
+	/** Watch specific error reports. */
+	protected class ProblemReporter playedBy ProblemReporter {
+
+		// a missing role in a binary team means the binary team should probably be deleted.
+		void missingRoleInBinaryTeam(ReferenceBinding type)
+		<- replace void missingRoleInBinaryTeam(char[] roleName, ReferenceBinding enclosingTeam)
+			with { type <- enclosingTeam }
+
+		callin void missingRoleInBinaryTeam(ReferenceBinding type) {
+			ReferenceContext context= getReferenceContext();
+			try {
+				base.missingRoleInBinaryTeam(type);
+			} finally {
+				if (context != null && context.compilationResult() != null) {			
+					int count= context.compilationResult().problemCount;
+					recordTypeToRemove(context.compilationResult().problems[count-1], 
+										  type.constantPoolName());
+				}
+			}
+		}
+
+		ReferenceContext getReferenceContext() -> get ReferenceContext referenceContext;
+	}
+
+	// ---- ImageBuilder is a role file ---- 
+
+	
+	// ---- Team level features: ----
+	void recordTypeToRemove(CategorizedProblem as Problem prob, char[] roleName) {
+		prob.typeToRemove= roleName;
+	}
+
+	public static boolean isPredefinedRole(char[] roleName) {
+		int dollarPos = CharOperation.lastIndexOf('$', roleName);
+		if (dollarPos != -1) 
+			roleName = CharOperation.subarray(roleName, dollarPos+1, -1);
+		return CharOperation.equals(roleName, IOTConstants.CONFINED)
+			|| CharOperation.equals(roleName, IOTConstants.OTCONFINED)
+			|| CharOperation.equals(roleName, IOTConstants.ICONFINED)
+			|| CharOperation.equals(roleName, IOTConstants.IBOUNDBASE)
+			|| CharOperation.equals(roleName, IOTConstants.ILOWERABLE);					
+	}
+	
+	/** Answer whether the given role type should be re-used (ask the ImageBuilder). */
+	public boolean shouldPreserveBinaryRole(ReferenceBinding role, CompilationResult as CompileResult cResult) {
+		if (builder == null)
+			return true;
+		return builder.shouldPreserveBinaryRole(role, cResult);
+	}
+	
+	public String canonicalName(String roleName) {
+		return roleName.replace(IOTConstants.OT_DELIM, ""); //$NON-NLS-1$
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager/ClassFileChangeTracker.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager/ClassFileChangeTracker.java
new file mode 100644
index 0000000..f1d9b75
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager/ClassFileChangeTracker.java
@@ -0,0 +1,62 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ClassFileChangeTracker.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+team package org.eclipse.objectteams.otdt.internal.compiler.adaptor.BuildManager;
+
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+
+
+/**
+ * This class tracks whenever a classfile has non-structural changes.
+ * In that case a re-compile is needed iff the class is a role of
+ * which copies exist in subteams within the workspace/project.
+ *  
+ * @author stephan
+ */
+@SuppressWarnings("restriction")
+public class ClassFileChangeTracker playedBy ClassFileReader 
+{	
+	void nonStructuralChange(String className) <- after boolean hasStructuralChanges(byte[] newBytes)
+			when (!result)
+			with {className <- new String(base.getName())}
+			
+	/** No structural changes where detected, yet bytes differ.*/
+	// static for optimization (avoid lifting).
+	protected static void nonStructuralChange(String className) {
+		className = className.replace('/', '.');
+		if (DEBUG >= 2)
+			System.out.println("Non-structural change for "+className); //$NON-NLS-1$
+		int dollarPos = className.lastIndexOf('$');
+		if (dollarPos == -1)
+			return; // not a role
+		String roleName = canonicalName(className.substring(dollarPos+1)); //excluding '$'	
+		Set<String> teamSourceFileNames = BuildManager.this.roleToSubTeams.get(className);
+		if (teamSourceFileNames != null)
+			for (String teamSourceFileName : teamSourceFileNames) { 
+				if (DEBUG > 0)
+					System.out.println("need to recompile "+teamSourceFileName);  //$NON-NLS-1$
+				BuildManager.this.teamsToRecompile.add(teamSourceFileName);
+				String teamTypeName = teamSourceFileName.substring(0, teamSourceFileName.length()-5); // .java
+				// mark both parts (class/ifc) as stale:
+				BuildManager.this.staleRoles.add(teamTypeName+'$'+roleName);
+				BuildManager.this.staleRoles.add(teamTypeName+'$'+IOTConstants.OT_DELIM+roleName);
+			}		
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager/ImageBuilder.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager/ImageBuilder.java
new file mode 100644
index 0000000..f434f76
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BuildManager/ImageBuilder.java
@@ -0,0 +1,269 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ImageBuilder.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+team package org.eclipse.objectteams.otdt.internal.compiler.adaptor.BuildManager;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.core.builder.SourceFile;
+import org.eclipse.jdt.internal.core.builder.WorkQueue;
+import org.eclipse.objectteams.otdt.core.compiler.OTNameUtils;
+
+/**
+ * @author stephan
+ */
+@SuppressWarnings("restriction")
+protected class ImageBuilder playedBy IncrementalImageBuilder 
+{
+	ImageBuilder (IncrementalImageBuilder builder) {
+		BuildManager.this.builder = this;
+	}
+	
+	// Set of teams being compiled due to our special request.
+	// don't preserve binary roles within such a team.
+	private HashSet<String> teamsForcedRecompilation = new HashSet<String>(); 
+	resetQueue:
+	void resetQueue() <- after void compile(SourceFile[] files);
+	void resetQueue() {
+		teamsForcedRecompilation.clear();
+	}
+
+	/**
+	 * Trigger B1: During processing a type with errors ... 
+	 */
+	storeProblemsFor <- replace storeProblemsFor;
+	
+	/** Before storing problems for a given source file, check whether the problem
+	 *  could be due to a binary role referring to a stale or missing tsuper-copy.
+	 *  In that case trigger recompilation. 
+	 *  The binary file will be deleted later ...
+	 */
+	callin void storeProblemsFor(SourceFile sourceFile, Problem[] problems) 
+		throws org.eclipse.core.runtime.CoreException 
+	{
+		if (sourceFile != null && problems != null && problems.length > 0) {
+			Problem[] remainingProblems = new Problem[problems.length];
+			int count = 0;
+			for (int i = 0; i < problems.length; i++) {
+				if (problems[i].couldBeFixedByRecompile()) {
+					// record the source file for recompilation:
+					ArrayList<SourceFile> sourceFiles = sourceFiles();
+					if (!sourceFiles.contains(sourceFile)) {
+						sourceFiles.add(sourceFile);
+						if (DEBUG>0)
+							System.out.println("Abort causes recompile of "+sourceFile); //$NON-NLS-1$
+					}
+					// don't add the problem to remainingProblems, because any IProblem.IsClassPathCorrect
+					// will abort this compilation! (we still think, we can fix this problem..)
+					char[] typePath= problems[i].typeToRemove;
+					if (typePath != null)
+						this.scheduleForRemoval(sourceFile, String.valueOf(typePath));
+				} else {
+					remainingProblems[count++] = problems[i];
+				}
+			}
+			if (count < problems.length)
+				System.arraycopy(remainingProblems, 0, problems = new Problem[count], 0, count);
+		}
+		base.storeProblemsFor(sourceFile, problems);
+	}
+	
+	void scheduleForRemoval(SourceFile sourceFile, String typePath) 
+		-> void scheduleForRemoval(SourceFile sourceFile, String typePath);
+	
+	/**
+	 * Trigger B2: During finishedWith() generated binary files are deleted, but some 
+	 *             should perhaps be preserved...
+	 */
+	shouldPreserveBinary <- replace shouldPreserveBinary;
+
+	/**
+	 * If the given binary type is a re-used member (role) preserve the binary file, 
+	 * HOWEVER, if it has dependency problems do NOT preserve it.
+	 * 
+	 * @param cResult
+	 * @param sourceFolder
+	 * @param packagePath
+	 * @param binaryTypeName
+	 * @return
+	 */
+	callin boolean shouldPreserveBinary(CompileResult cResult,
+									    IPath sourceFolder,
+										IPath packagePath,
+										char[] binaryTypeName) 
+	{
+		// don't preserve re-used binary types with problems. They might be stale.
+		if (!base.shouldPreserveBinary(cResult, sourceFolder, packagePath, binaryTypeName))
+			return false;
+		return shouldPreserveBinaryRole(cResult, sourceFolder, packagePath, binaryTypeName);
+	}
+	/** Entry from AdaptorActivator.CopyInheritanceObserver (via BuildManager): */
+	protected boolean shouldPreserveBinaryRole(ReferenceBinding role, CompileResult cResult) {
+		String fileName    = new String(cResult.getFileName());
+		IPath packagePath  = new Path(fileName).removeLastSegments(1);
+		int packageDepth   = role.getPackage().compoundName.length;
+		IPath sourceFolder = packagePath.removeLastSegments(packageDepth);	
+		packagePath        = packagePath.removeFirstSegments(sourceFolder.segmentCount());
+		char[][] roleName  = CharOperation.splitOn('.', role.attributeName());
+		boolean result = shouldPreserveBinaryRole(cResult, sourceFolder, packagePath, roleName[roleName.length-1]); // Team$Role
+		if (!result)
+			scheduleForRemoval(findTeamSourceFile(fileName), new String(role.constantPoolName()));
+		return result;
+	}
+	/** Common implementation for the two entries above.
+	 *  Both clients when receiving a 'false' answer will remove the stale binary class.
+	 *  This will ensure that during the next cycle this type will be compiled from source.
+	 */
+	boolean shouldPreserveBinaryRole(CompileResult cResult, IPath sourceFolder, IPath packagePath, char[] binaryTypeName) 
+	{
+		// binary type with problem -> NO 		
+		if (binaryHasProblem(cResult.problems(), binaryTypeName))
+			return false;
+		
+		String binaryTypeString = packagePath.toString()+"/"+new String(binaryTypeName);
+		if (DEBUG >= 2)
+			System.out.print("candidate for preserving: "+binaryTypeString); //$NON-NLS-1$
+		
+		// predefined type -> YES
+		if (isPredefinedRole(binaryTypeName)) {
+			if (DEBUG >= 2)
+				System.out.println(" YES(predefined)."); //$NON-NLS-1$
+			return true;
+		}
+		// others: further investigate.
+		boolean shouldPreserve = shouldCandidateBePreserved(sourceFolder, binaryTypeString);
+		if (!shouldPreserve)
+			// propagate changes down to sub-teams:
+			ClassFileChangeTracker.nonStructuralChange(binaryTypeString);
+		return shouldPreserve;
+	}
+	/** Checks the following reasons against preserving:<ul>
+	 *  <li> the enclosing team is forced for recompilation (meaning: full recompilation)
+	 *  <li> the given type is a role known to be stale                                   */
+	boolean shouldCandidateBePreserved(IPath sourceFolder, String binaryTypeString) 
+	{
+		int dollarPos = binaryTypeString.lastIndexOf('$');
+		String enclosingRelativeFileString = binaryTypeString.substring(0, dollarPos)+".java"; //$NON-NLS-1$
+		String enclosingAbsoluteFileString = sourceFolder.append(enclosingRelativeFileString).toString();
+		for (String teamFileName : teamsForcedRecompilation) {
+			if (teamFileName.equals(enclosingAbsoluteFileString)) {
+				if (DEBUG >= 2)
+					System.out.println(" NO(forced)."); //$NON-NLS-1$
+				BuildManager.this.teamsToRecompile.add(teamFileName); // let binary roles be removed and try again.
+				return false;
+			}
+		}		
+		binaryTypeString = sourceFolder.append(binaryTypeString).toString();
+		if (BuildManager.this.staleRoles.contains(binaryTypeString)) {
+			BuildManager.this.staleRoles.remove(binaryTypeString);
+			if (DEBUG >= 2)
+				System.out.println(" NO(changed).");
+			return false;
+		}
+		
+		if (DEBUG >= 2)
+			System.out.println(" YES");
+		return true;		
+	}
+	
+	/** Is the given binary type known to have an unresolved dependency? */
+	boolean binaryHasProblem(Problem[] problems, char[] binaryTypeName) {
+		if (problems != null) 
+			for (Problem problem : problems) 
+				if (problem != null && problem.abortException != null) {
+					Abort abort = problem.abortException;
+					for (BinaryType binding : abort.referencedBinaries) {
+						char[][] compoundName = binding.compoundName();
+						if (CharOperation.equals(compoundName[compoundName.length-1], binaryTypeName))
+							return true;
+					}
+				}
+		// remove "__OT__" from binaryTypeName
+		char[] strippedName = OTNameUtils.removeOTDelim(binaryTypeName);
+		if (strippedName != binaryTypeName)
+			return binaryHasProblem(problems, strippedName);
+		return false;
+	}
+	
+	// Trigger: after adding source files to compile,
+	//          consider any roles which have been copied:
+	//          if the source changed, all sub teams must be recompiled.
+	void addAffectedTeamFiles() <- after void addAffectedSourceFiles();
+	
+	void addAffectedTeamFiles() {
+		// fetch sets of teams:
+		Set<String> teamFiles = fetchTeamsToRecompile();
+		
+		ArrayList<SourceFile> sourceFiles = sourceFiles();
+		
+		// add all relevant teams to sourceFiles:
+		for (String teamName : teamFiles) {
+			SourceFile teamFile = findTeamSourceFile(teamName);
+			if (   teamFile != null 
+				&& !sourceFiles.contains(teamFile)) 
+			{
+				if (DEBUG>0)
+					System.out.println("Scheduling for recompilation: teamFile "+teamFile+" for "+teamName); //$NON-NLS-1$ //$NON-NLS-2$
+				sourceFiles.add(teamFile);
+				teamsForcedRecompilation.add(teamName);
+			}
+		}
+	}
+	SourceFile findTeamSourceFile(String teamName) {
+		IWorkspace ws = ResourcesPlugin.getWorkspace();
+		IFile file = ws.getRoot().getFile(new Path(teamName));
+		return findSourceFile(file);
+	}
+
+	// ==== GENERAL ACCESS TO BASE ELEMENTS: ====
+	
+	@SuppressWarnings("decapsulation")
+	SourceFile findSourceFile(IFile file) -> SourceFile findSourceFile(IFile file, boolean mustExist)
+		with { file -> file, true -> mustExist, result <- result }
+
+	@SuppressWarnings({"decapsulation", "unchecked"})
+	ArrayList<SourceFile> sourceFiles() -> get ArrayList<SourceFile> sourceFiles;
+	
+	@SuppressWarnings("decapsulation")
+	WorkQueue   getWorkQueue()          -> get WorkQueue workQueue;
+		
+	// ==== LOGGING ====
+	void logCompile(String msg) <- before void compile(SourceFile[] units)
+		with { msg <- "Starting" }
+
+	logDone:
+	void logCompile(String msg) <- after void compile(SourceFile[] units)
+		with { msg <- "Done" }
+
+	void logCompile(String msg)
+		when (DEBUG > 0)
+	{
+		System.out.println("Incremental compilation: "+msg+" for "+getWorkQueue());
+	}
+	
+	precedence resetQueue, logDone;
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/CompilationThreadWatcher.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/CompilationThreadWatcher.java
new file mode 100644
index 0000000..7b4ca0c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/CompilationThreadWatcher.java
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CompilationThreadWatcher.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import base org.eclipse.jdt.internal.compiler.ProcessTaskManager;
+
+/**
+ * This team observes the ProcessTaskManager in order to extend team activation
+ * of sub-teams to the processingTask once it is created.
+ * 
+ * @author stephan
+ * @since 1.2.0
+ */
+@SuppressWarnings("restriction")
+public team class CompilationThreadWatcher 
+{
+	protected class ProcessTaskManager playedBy ProcessTaskManager 
+	{
+		
+		@SuppressWarnings("decapsulation")
+		Thread getProcessingThread() -> get Thread processingThread; 
+
+		
+		extendActivation <- after setConfig;
+		void extendActivation() {
+			CompilationThreadWatcher.this.activate(getProcessingThread());
+		}
+		
+
+		void cleanup() <- after void run();
+		void cleanup() { CompilationThreadWatcher.this.deactivate(); }
+		
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/IllegalReusedBinaryRoleException.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/IllegalReusedBinaryRoleException.java
new file mode 100644
index 0000000..04f52fb
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/IllegalReusedBinaryRoleException.java
@@ -0,0 +1,29 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: IllegalReusedBinaryRoleException.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+@SuppressWarnings("serial")
+public class IllegalReusedBinaryRoleException extends RuntimeException {
+	public IllegalReusedBinaryRoleException(String msg) {
+		super(msg);
+	}
+	
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/PDEAdaptor.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/PDEAdaptor.java
new file mode 100644
index 0000000..ff3c448
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/PDEAdaptor.java
@@ -0,0 +1,273 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: PDEAdaptor.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.core.ClasspathAccessRule;
+import org.eclipse.osgi.service.resolver.BundleDescription;
+import org.eclipse.osgi.service.resolver.ExportPackageDescription;
+import org.eclipse.osgi.service.resolver.StateHelper;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
+
+import base org.eclipse.pde.internal.core.PDEClasspathContainer;
+import base org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer;
+import base org.eclipse.pde.internal.core.PDEClasspathContainer.Rule;
+import base org.eclipse.pde.internal.core.bundle.BundlePluginModel;
+import base org.eclipse.pde.internal.core.plugin.WorkspaceExtensionsModel;
+
+/**
+ * Adapt classes from the PDE core as to feed information about aspectBindings
+ * into the compilation process (to be consumed by BaseImportChecker).
+ * 
+ * Final target as expected by the BaseImportChecker:
+ *  + aspectBindingData (of type AdaptedBaseBundle) have been added to ClasspathAccessRules 
+ *    and the problemID has been adjusted.
+ * 
+ * 
+ * @author stephan
+ * @since 1.1.5
+ */
+@SuppressWarnings("restriction")
+public team class PDEAdaptor 
+{
+	static PDEAdaptor instance; 
+	
+	public PDEAdaptor() {
+		instance= this;
+	}
+
+	/**
+	 * <ul> 
+	 * <li>Store aspectBinding info in Role objects.</li>
+	 * <li>Add additional rules for forcedExports.</li>
+	 * </ul> 
+	 */
+	protected class RequiredPluginsClasspathContainer
+			extends PDEClasspathContainer
+			playedBy RequiredPluginsClasspathContainer 
+	{
+		
+		protected AspectBindingReader aspectBindingReader;
+		
+		void updateRule(String providingBundle, Rule rule) 
+		 <- after Rule getRule(StateHelper helper, BundleDescription desc, ExportPackageDescription export)
+			with { providingBundle <- export.getExporter().getSymbolicName(),
+				   rule            <- result
+			}
+		/** Handles adaptation info for exported packages, Rule role created via regular lifting. */
+		void updateRule(String providingBundle, Rule rule) {
+			if (aspectBindingReader != null && aspectBindingReader.isAdaptedBase(providingBundle)) {
+				// no merging because rule (base & role) are fresh instances
+				rule.aspectBindingData= aspectBindingReader.getAdaptationInfo(providingBundle);
+			}
+		}
+		
+		@SuppressWarnings({ "decapsulation", "rawtypes" })
+		Rule[] addForcedExports(BundleDescription desc) 
+		 <- replace Rule[] getInclusions(Map map, BundleDescription desc)
+		    with { desc <- desc }
+		/** Handles adaptation info for non-exported packages, Rule role explicitly created. */		
+		callin Rule[] addForcedExports(BundleDescription desc) 
+		{
+			Rule[] regularRules= base.addForcedExports(desc);
+			if (aspectBindingReader == null)
+				return regularRules; // done: no aspect bindings
+			HashSet<String> forcedExports= aspectBindingReader.getForcedExports(desc.getSymbolicName());
+			if (forcedExports == null)
+				return regularRules; // done: no forced exports
+			
+			AdaptedBaseBundle aspectBindingData= aspectBindingReader.getAdaptationInfo(desc.getSymbolicName());			
+			// create additional rules:
+			Rule[] additionalRules= new Rule[forcedExports.size()];
+			Iterator<String> exportIter= forcedExports.iterator();
+			for (int i = 0; i < additionalRules.length; i++) 
+				additionalRules[i]= new Rule(this, aspectBindingData, exportIter.next());
+			
+			// merge arrays:
+			int len1= regularRules.length, len2= additionalRules.length;
+			Rule[] result= new Rule[len1+len2];
+			System.arraycopy(additionalRules, 0, result, 0, len2);
+			System.arraycopy(regularRules, 0, result, len2, len1);
+			
+			return result;
+		}
+		
+		@SuppressWarnings("decapsulation")
+		protected
+		BundleModel getBundleModel() -> get IPluginModelBase fModel
+			with { result <- (BundlePluginModel)fModel }
+
+		// -- debug: --		
+		String baseToString() => String toString();
+		
+		@SuppressWarnings("nls")
+		@Override
+		public String toString() {
+			return "Role for "+baseToString()+" with aspectBindingReader\n  "
+				  + ((this.aspectBindingReader != null) ? this.aspectBindingReader.toString() : "null");
+		}
+	}
+	
+	/**
+	 * Synthetic rules representing adapted or forcedExports.
+	 */
+	@SuppressWarnings("decapsulation")
+	protected class Rule playedBy Rule 
+	{
+		void setPath(IPath path) -> set IPath path;
+
+		// intermediate storage between AspectBindingReader and ClasspathAccessRule:
+		protected AdaptedBaseBundle aspectBindingData; 
+		protected boolean isForcedExport;
+		
+		/** Ctor for force-exported packages (merely adapted packages instantiate via lifting ctor). */
+		protected Rule(RequiredPluginsClasspathContainer encl, AdaptedBaseBundle aspectBindingData, String packageName) 
+		{
+			encl.base();
+			String pattern= packageName.replace('.', '/')+"/*"; //$NON-NLS-1$
+			setPath(new Path(pattern));
+			this.aspectBindingData= aspectBindingData;
+			this.isForcedExport= true;
+		}
+		// -- debug: --
+		String baseToString() => String toString();
+		
+		@SuppressWarnings("nls")
+		@Override
+		public String toString() {
+			String result= baseToString();
+			if (this.isForcedExport)
+				result+= " (forced export)";
+			return result+" with aspect data\n  "
+				  + ((this.aspectBindingData == null) ? "null" : this.aspectBindingData.toString());
+		}		
+	}
+	
+	/** After converting Rules to IAccessRules transfer adaptation info and adjust problemId. */
+	protected class PDEClasspathContainer playedBy PDEClasspathContainer 
+	{
+		void getAccessRules(Rule[] rules, IAccessRule[] accessRules) 
+		  <- after IAccessRule[] getAccessRules(Rule[] rules)
+			 with { rules <- rules, accessRules <- result }
+		static void getAccessRules(Rule[] rules, IAccessRule[] accessRules) {
+			for (int i = 0; i < rules.length; i++) {
+				Rule rule = rules[i];
+				if (rule.aspectBindingData != null) {
+					ClasspathAccessRule classpathAccessRule = (ClasspathAccessRule)accessRules[i];
+					if (rule.isForcedExport) {
+						// don't let this rule leak to other clients
+						classpathAccessRule = new ClasspathAccessRule(classpathAccessRule.pattern, IProblem.BaseclassDecapsulationForcedExport);
+						classpathAccessRule.aspectBindingData = new Object[] { rule.aspectBindingData };
+						accessRules[i] = classpathAccessRule;
+					} else { 
+						addAspectBindingData(classpathAccessRule, rule.aspectBindingData);
+					}
+				}
+			}
+		}
+	}
+	/**
+     * Add the given aspect binding data to the given access rule.
+     * @return: has data been added (vs. merged or already present)? 
+	 */
+	public static boolean addAspectBindingData(ClasspathAccessRule accessRule, AdaptedBaseBundle aspectBindingData) {
+		// nothing present yet?
+		if (accessRule.aspectBindingData == null) {
+			accessRule.aspectBindingData = new Object[] { aspectBindingData };
+			if (accessRule.problemId == 0)
+				accessRule.problemId= IProblem.AdaptedPluginAccess;
+			return true;
+		}
+		// exact binding data already present?
+		for (Object data : accessRule.aspectBindingData)
+			if (data == aspectBindingData)
+				return false;
+		// different binding data for the same base bundle present?
+		for (Object data : accessRule.aspectBindingData)
+			if (((AdaptedBaseBundle)data).merge(aspectBindingData))
+				return false;
+		// different base bundles, must be the case of split packages
+		for (Object data : accessRule.aspectBindingData)
+			((AdaptedBaseBundle)data).hasPackageSplit = true;
+		aspectBindingData.hasPackageSplit = true;
+		int len = accessRule.aspectBindingData.length;
+		System.arraycopy(accessRule.aspectBindingData, 0, accessRule.aspectBindingData = new Object[len+1], 0, len);
+		accessRule.aspectBindingData[len] = aspectBindingData;
+		return true;
+	}
+
+	/** Helper role for updating aspect binding information. */
+	protected class BundleModel playedBy BundlePluginModel {
+		protected AspectBindingReader aspectBindingReader;
+		
+	}
+	
+	/** 
+	 * This role listens to updates on its base.
+	 * If the associated bundle model has a role with a registered
+	 * aspect binding reader, trigger reloading when the model has changed. 
+	 */
+	protected class ModelListener playedBy WorkspaceExtensionsModel {
+		void resetAspectReader() <- after void load(InputStream is, boolean reload);
+		void resetAspectReader () throws CoreException {
+			try {
+				BundleModel bundle= getFBundleModel();
+				if (bundle != null && bundle.aspectBindingReader != null)
+					bundle.aspectBindingReader.reload();
+			} catch (ClassCastException cce) {
+				// CCE could be thrown by parameter mapping of getFBundleModel().
+			}
+		}
+		/** This declaration is for documentation only: read the fBundleModel field.
+		 * @return a BundleModel role
+		 * @throws ClassCastException thrown when fBundleModel is not a BundlePluginModel.
+		 */
+		abstract BundleModel getFBundleModel() throws ClassCastException;
+		@SuppressWarnings("decapsulation")
+		BundleModel getFBundleModel() -> get IBundlePluginModelBase fBundleModel
+			with { result <- (BundlePluginModel)fBundleModel }
+	}
+
+	/** Register an aspect binding reader for a given RequiredPluginsClasspathContainer. */
+	void setAspectBindingReader(AspectBindingReader aspectBindingReader,
+		RequiredPluginsClasspathContainer as RequiredPluginsClasspathContainer container) 
+	{
+		container.aspectBindingReader= aspectBindingReader;
+		try {
+			// link bundle model and reader for updating lateron:
+			BundleModel bundle= container.getBundleModel();
+			if (bundle != null)
+				bundle.aspectBindingReader= aspectBindingReader;
+		} catch (ClassCastException cce) {
+			// can happen in param mapping of c-t-f, wrong model type, ignore.
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/PlainProjectWatcher.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/PlainProjectWatcher.java
new file mode 100644
index 0000000..d1258ce
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/PlainProjectWatcher.java
@@ -0,0 +1,57 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: PlainProjectWatcher.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
+import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+
+import base org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
+
+/**
+ * This team advises the ProblemReporter for non-OT-Plugin projects.
+ * These projects must simply ignore `AccessRestrictions' with
+ * problemId AdaptedPluginAccess, which is not a real problem.
+ *   
+ * @author stephan
+ * @since 1.1.5
+ */
+@SuppressWarnings("restriction")
+public team class PlainProjectWatcher extends CompilationThreadWatcher
+{
+	protected class ProblemReporter playedBy ProblemReporter 
+	{
+		void forbiddenReference(AccessRestriction restriction) 
+		<- replace void forbiddenReference(TypeBinding   type,   ASTNode location, byte entryType, AccessRestriction restriction),
+				   void forbiddenReference(FieldBinding  field,  ASTNode location, byte entryType, AccessRestriction restriction),
+				   void forbiddenReference(MethodBinding method, ASTNode location, byte entryType, AccessRestriction restriction)
+		   with { restriction <- restriction }
+
+		@SuppressWarnings("basecall")
+		callin void forbiddenReference(AccessRestriction restriction) {
+			if (restriction.getProblemId() != IProblem.AdaptedPluginAccess)
+				base.forbiddenReference(restriction);
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/ProjectUtil.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/ProjectUtil.java
new file mode 100644
index 0000000..a7d4b5c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/ProjectUtil.java
@@ -0,0 +1,63 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ProjectUtil.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import org.eclipse.core.internal.resources.Project;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.ExternalJavaProject;
+import org.eclipse.objectteams.otdt.core.ext.OTJavaNature;
+
+@SuppressWarnings("restriction")
+public class ProjectUtil {
+
+	static final String PLUGIN_ID = "org.eclipse.objectteams.otdt.internal.compiler.adaptor";  //$NON-NLS-1$
+	
+	// Don't use API from from PDE, to reduce dependencies.
+	static final String PLUGIN_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$
+	
+	public static Project safeGetOTPluginProject(ICompilationUnit unitElem) {
+		IJavaProject project= unitElem.getJavaProject();
+		if (ProjectUtil.isOTPluginProject(project.getProject()))
+			return (Project)project.getProject();
+		return null;
+	}
+
+	public static boolean isOTPluginProject(IProject project)  {
+		if (project == null) return false;
+		try {
+			return    project.hasNature(PLUGIN_NATURE)
+			       && OTJavaNature.hasOTJavaNature(project);
+		} catch (CoreException e) {
+			if (!ExternalJavaProject.EXTERNAL_PROJECT_NAME.equals(project.getName())) // see JavaProject.hasJavaNature()
+				JavaCore.getJavaCore().getLog().log(new Status(IStatus.ERROR, 
+															   PLUGIN_ID, 
+															   "Error reading project natures",          //$NON-NLS-1$
+															   e));
+			return false;
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/ResourceProjectAdaptor.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/ResourceProjectAdaptor.java
new file mode 100644
index 0000000..333aa95
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/ResourceProjectAdaptor.java
@@ -0,0 +1,86 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008, 2010 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ResourceProjectAdaptor.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import org.objectteams.LiftingVetoException;
+import org.objectteams.Team;
+
+import base org.eclipse.core.internal.resources.Project;
+
+/**
+ * Simple decoration of class Project from org.eclipse.core.resources.
+ *  
+ * @author stephan
+ * @since 1.1.8
+ */
+@SuppressWarnings("restriction")
+public team class ResourceProjectAdaptor 
+{
+	private static ResourceProjectAdaptor instance;
+	public ResourceProjectAdaptor() {
+		instance= this;
+	}
+	public static ResourceProjectAdaptor getDefault() { return instance; }
+	
+	/** Associate an AspectBindingReader and a BaseImportChecker to each OT Plugin project. */
+	protected class OTEquinoxProject playedBy Project
+	{
+		protected AspectBindingReader aspectBindingReader;
+		protected BaseImportChecker checker;
+
+		/** 
+		 * Lifting constructor which refuses lifting for non OT-plugin projects,
+		 * or if the project is not yet ready for reading plugin.xml. 
+		 */
+		public OTEquinoxProject(Project baseProject) {
+			try {
+				if (!ProjectUtil.isOTPluginProject(baseProject))
+					throw new org.objectteams.LiftingVetoException();
+				this.aspectBindingReader = new AspectBindingReader(baseProject); // may also throw LVE.
+				this.checker= new BaseImportChecker(this.aspectBindingReader);
+			} catch (LiftingVetoException lve) {
+				// no success: unregister this useless role
+				ResourceProjectAdaptor.this.unregisterRole(this, OTEquinoxProject.class);
+				throw lve; // will be caught in several clients within AdaptorActivator
+			}
+		}
+		/** ask for changes to determine if classpath has to be recomputed: */
+		protected boolean hasAspectDataChanged () {
+			return this.aspectBindingReader != null
+				&& this.aspectBindingReader.fetchHasChanges();
+		}
+	}
+
+	// ======== API: =========
+	
+	public Team getChecker(Project as OTEquinoxProject project) 
+			throws LiftingVetoException 
+	{
+		return project.checker;
+	}
+	public AspectBindingReader getAspectBindingReader(Project as OTEquinoxProject project) 
+			throws LiftingVetoException 
+	{
+		return project.aspectBindingReader;
+	}
+	public boolean hasAspectDataChanged(Project as OTEquinoxProject project)  
+			throws LiftingVetoException 
+	{
+		return project.hasAspectDataChanged();
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/RoleReuseGuard.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/RoleReuseGuard.java
new file mode 100644
index 0000000..6345187
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/RoleReuseGuard.java
@@ -0,0 +1,197 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2006, 2010 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: RoleReuseGuard.java 23451 2010-02-04 20:33:32Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.compiler.adaptor;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct;
+import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
+import org.eclipse.jdt.internal.compiler.env.IBinaryType;
+import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+
+import base org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
+import base org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
+import base org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
+import base org.eclipse.objectteams.otdt.internal.core.compiler.ast.RoleFileCache;
+import base org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.AbstractAttribute;
+import base org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.WordValueAttribute;
+
+/**
+ * This team avoids the situation that a source team when loading its RoFi cache
+ * loads a binary role which is neither purely copied nor a role file.
+ * Such roles are either stale (no longer present in the team) or in some other
+ * way conflict with a role currently being translated.
+ * 
+ * By intervening in classfile lookup we prevent conflicting binaries to be 
+ * stored by the LookupEnvironment.
+ * 
+ * @author stephan
+ */
+@SuppressWarnings("restriction")
+public team class RoleReuseGuard 
+{
+	public static int DEBUG = 2; // levels: 0 nothing, 1 some, 2 more.
+
+	// ==== the following roles communicate a cflow-dependency via this field:  ====
+	static ThreadLocal<Object> isLoadingRolesOfSourceType = new ThreadLocal<Object>();
+
+	/** Reflect base super-class by a corresponding role super-class. */
+	protected class AbstractAttribute playedBy AbstractAttribute {
+		protected boolean nameEquals(char[] name) -> boolean nameEquals(char[] name);
+	}
+	
+	/** This role is a trigger in UseCase A. */
+	protected class WordValueAttribute 
+			extends AbstractAttribute 
+			playedBy WordValueAttribute 
+	{
+		void checkClassFlags(WordValueAttribute attr) 
+		<- after WordValueAttribute readClassFlags(ClassFileStruct reader, 
+												   int             readOffset,
+												   int[]           constantPoolOffsets)
+		with { attr <- result }
+		
+		static void checkClassFlags(WordValueAttribute attr) {
+			if (RoleReuseGuard.isLoadingRolesOfSourceType.get() != null)
+				checkNonReusableRole(attr.getValue());
+		}
+		@SuppressWarnings("decapsulation")
+		protected
+		int getValue() -> get int _value;
+		toString => toString;
+	}
+	
+	/** A pure cflow-guard. */
+	protected class RoFiTracker
+			playedBy RoleFileCache 
+	{
+		@SuppressWarnings("decapsulation")
+		cflow <- replace readBinary;
+		@SuppressWarnings("basecall")
+		callin void cflow() {
+			Object save = isLoadingRolesOfSourceType.get();
+			isLoadingRolesOfSourceType.set(new Object());
+			try {
+				base.cflow();
+			} catch (IllegalReusedBinaryRoleException irbre) {
+				// do nothing. role could simply not be re-used.
+			} finally {
+				isLoadingRolesOfSourceType.set(save);
+			}
+		}		
+	}
+	
+	protected class SourceTypeBinding playedBy SourceTypeBinding 
+	{
+		getMemberType <- replace getMemberType;
+		@SuppressWarnings("basecall")
+		callin ReferenceBinding getMemberType(char[] name) {
+			Object save = isLoadingRolesOfSourceType.get();
+			isLoadingRolesOfSourceType.set(new Object());
+			try {
+				return base.getMemberType(name);
+			} catch (IllegalReusedBinaryRoleException ex) {
+				if (DEBUG>0)
+					System.out.println("refused reusing type "+new String(name)); //$NON-NLS-1$
+				return null; // pretend type was not found.
+			} finally {
+				isLoadingRolesOfSourceType.set(save);
+			}
+		}		
+		ReferenceBinding[] getSuperInterfaces() 			  -> get ReferenceBinding[] superInterfaces;
+		void setSuperInterfaces(ReferenceBinding[] superIfcs) -> set ReferenceBinding[] superInterfaces; 
+	}
+	
+	protected class SafeEnvironment playedBy LookupEnvironment {
+		ReferenceBinding askForType(char[][] typeName) 
+			<- replace ReferenceBinding askForType(char[][] typeName);
+		@SuppressWarnings("basecall")
+		callin ReferenceBinding askForType(char[][] typeName) {
+			try {
+				return base.askForType(typeName);
+			} catch (IllegalReusedBinaryRoleException irbre) {
+				if (DEBUG>0) {
+					String rn = new String(CharOperation.concatWith(typeName, '.'));
+					System.out.println("rejected binary role "+rn); //$NON-NLS-1$
+				}
+				return null;
+			}
+		}
+
+		void checkEnclosing(ReferenceBinding created) 
+			<- after BinaryTypeBinding createBinaryTypeFrom(IBinaryType       binaryType, 
+															PackageBinding    packageBinding, 
+															boolean 		  needFieldsAndMethods, 
+															AccessRestriction accessRestriction)
+			with { created <- result }
+		
+		/**
+		 * When reading a binary type as a member of a source type,
+		 * check whether this is OK or whether the binary member
+		 * should be discarded.
+		 */		
+		void checkEnclosing(ReferenceBinding type) {
+			ReferenceBinding enclosing = type.enclosingType();
+			if (enclosing != null && !enclosing.isBinaryBinding() && type.isRole()) {
+				int flags = type.roleModel.getExtraRoleFlags();
+				checkNonReusableRole(flags);
+			}
+		}
+	}
+	
+	
+	protected class BinaryType playedBy BinaryTypeBinding 
+	{	
+		
+		// reverse the effect from SourceTypeBinding in case of nested lookup.
+		getMemberType <- replace getMemberType;
+		callin ReferenceBinding getMemberType(char[] name) {
+			Object save = isLoadingRolesOfSourceType.get();
+			isLoadingRolesOfSourceType.remove();
+			try {
+				return base.getMemberType(name);
+			} finally {
+				isLoadingRolesOfSourceType.set(save);
+			}
+		}		
+		
+		// ==== Callouts: ==== 
+		
+		// DEBUGGING:
+		String internalName() -> char[] internalName() 
+			with { result <- new String(result) }
+	}
+
+	
+	/** Trigger of UseCase A. */
+	static void checkNonReusableRole(int otClassFlags)
+		throws IllegalReusedBinaryRoleException
+	{
+		if ((otClassFlags & IOTConstants.OT_CLASS_ROLE) == 0) 
+			return;
+		int specialRoleFlags = IOTConstants.OT_CLASS_PURELY_COPIED|IOTConstants.OT_CLASS_ROLE_FILE;
+		if ((otClassFlags & specialRoleFlags) == 0)
+		{ 
+			if (DEBUG>0)
+				System.out.println("throwing!!! "+otClassFlags); //$NON-NLS-1$
+			RuntimeException t = new IllegalReusedBinaryRoleException("don't reuse explicit inline role"); //$NON-NLS-1$
+			//t.printStackTrace();
+			throw t;
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.classpath b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.classpath
new file mode 100644
index 0000000..987380a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="con" path="OTRE"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.project b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.project
new file mode 100644
index 0000000..1dececd
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.objectteams.otdt.debug.adaptor</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.objectteams.otdt.builder.OTJBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.objectteams.otdt.OTJavaNature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..5fbade3
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,28 @@
+#Sat Oct 03 22:14:54 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.objectteams.otdt.compiler.option.joinpoint_queries=disabled
+org.objectteams.otdt.compiler.option.scoped_keywords=enabled
+org.objectteams.otdt.compiler.problem.abstract_potential_relevant_role=warning
+org.objectteams.otdt.compiler.problem.adapting_deprecated=error
+org.objectteams.otdt.compiler.problem.ambiguous_lowering=warning
+org.objectteams.otdt.compiler.problem.basecall=warning
+org.objectteams.otdt.compiler.problem.binding_conventions=error
+org.objectteams.otdt.compiler.problem.decapsulation=warning
+org.objectteams.otdt.compiler.problem.deprecated_path_syntax=warning
+org.objectteams.otdt.compiler.problem.exception_in_guard=error
+org.objectteams.otdt.compiler.problem.fragile_callin=warning
+org.objectteams.otdt.compiler.problem.inferred_callout=warning
+org.objectteams.otdt.compiler.problem.override_final_role=error
+org.objectteams.otdt.compiler.problem.potential_ambiguous_playedby=warning
+org.objectteams.otdt.compiler.problem.unsafe_role_instantiation=warning
+org.objectteams.otdt.compiler.problem.weave_into_system_class=warning
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..199ef5f
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DebugAdaptor Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.debug.adaptor;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Bundle-Vendor: objectteams.org
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.objectteams.otequinox,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.ui,
+ org.eclipse.debug.ui,
+ org.eclipse.jdt.debug,
+ org.eclipse.jdt.debug.ui,
+ org.eclipse.objectteams.otdt.debug.ui,
+ org.eclipse.jface,
+ org.eclipse.ui,
+ org.eclipse.pde.ui,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.junit,
+ org.eclipse.objectteams.otdt,
+ org.eclipse.objectteams.otdt.debug,
+ org.eclipse.objectteams.otdt.ui,
+ org.eclipse.ui.editors,
+ org.eclipse.jface.text
+Bundle-Activator: org.eclipse.objectteams.otdt.internal.debug.adaptor.OTDebugAdaptorPlugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/build.properties b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/build.properties
new file mode 100644
index 0000000..0dc34f7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               plugin.properties
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/plugin.properties b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/plugin.properties
new file mode 100644
index 0000000..29c17aa
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/plugin.properties
@@ -0,0 +1,8 @@
+OtGeneratedCodeColorDescription.label=OT/J generated code

+OtGeneratedCodeColorDescription.description=The color by which the debug view marks stack frames that do not correspond to source code\n(generated by compiler or runtime-environment) 

+OtSpecialCodeColorDescription.label=OT/J special source code

+OtSpecialCodeColorDescription.description=The color by which the debug view highlights special OT/J source code\n(method bindings, guard predicates etc.)

+

+showOTInternalAction.label=Show &OT/J Internal Variables

+showOTInternalAction.tooltip=Show internal variables which the OT/J compiler and weaver have generated.

+VariablesViewJavaSubmenu.label=&Java

diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/plugin.xml b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/plugin.xml
new file mode 100644
index 0000000..b7f076b
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/plugin.xml
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.objectteams.otequinox.aspectBindings">
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.debug.ui">
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.VariablesViewAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.DebugUIDialogAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.PresentationAdaptorActivator"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.debug.ui">
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.PresentationAdaptorActivator"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.JDTDebugUILaunchingAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.DebugUIDialogAdaptor2"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+               superclass="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.DebugUIDialogAdaptor">
+         </team>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.RetargettableActionAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.debug">
+         </basePlugin>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.PresentationAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.SourceLookupAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+     <aspectBinding
+           icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+        <basePlugin
+              icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+              id="org.eclipse.pde.ui">
+        </basePlugin>
+        <team
+              activation="ALL_THREADS"
+              class="org.eclipse.objectteams.otdt.internal.debug.adaptor.SourceLookupAdaptor"
+              icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+        </team>
+        <team
+              activation="ALL_THREADS"
+              class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.PDELaunchingAdaptor"
+              icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+        </team>
+     </aspectBinding>
+     <aspectBinding
+           icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+        <basePlugin
+              icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+              id="org.eclipse.debug.core">
+        </basePlugin>
+        <team
+              activation="ALL_THREADS"
+              class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.LaunchConfigurationInitializer"
+              icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+        </team>
+     </aspectBinding> 
+     <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.launching">
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.JDTLaunchingAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+     </aspectBinding>
+     <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.junit.core">
+         </basePlugin>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.JUnitLaunchingAdaptor"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+               superclass="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.JDTLaunchingAdaptor">
+         </team>
+     </aspectBinding>
+     <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="org.eclipse.jdt.junit">
+         </basePlugin>
+         <team
+               activation="NONE"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.DebugUIDialogAdaptor3"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"
+               superclass="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.DebugUIDialogAdaptor2">
+         </team>
+     </aspectBinding>
+     <aspectBinding
+           icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+        <basePlugin
+              icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+              id="org.eclipse.jdt.ui">
+        </basePlugin>
+        <team
+              activation="NONE"
+              class="org.eclipse.objectteams.otdt.internal.debug.adaptor.PresentationAdaptor"
+              icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+        </team>
+     </aspectBinding>
+     <aspectBinding
+           icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+        <basePlugin
+              icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+              id="org.eclipse.pde.launching">
+        </basePlugin>
+        <team
+              activation="ALL_THREADS"
+              class="org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.PDELaunchingAdaptor"
+              icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+        </team>
+     </aspectBinding>
+   </extension>
+   <extension
+         point="org.eclipse.ui.viewActions">
+      <viewContribution
+            targetID="org.eclipse.debug.ui.VariableView"
+            id="org.eclipse.objectteams.otdt.internal.debug.adaptor.VariableViewActions">
+         <action
+               style="toggle"
+               id="org.eclipse.objectteams.otdt.internal.debug.adaptor.variableViewActions.ShowOTInternal"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.actions.ShowOTInternalVariablesAction"
+               helpContextId="show_otinternal_action_context"
+               label="%showOTInternalAction.label"
+               menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart"
+               tooltip="%showOTInternalAction.tooltip">
+         </action>
+       </viewContribution>
+             <viewContribution
+            targetID="org.eclipse.objectteams.otdt.debug.ui.views.team"
+            id="org.eclipse.objectteams.otdt.internal.debug.adaptor.VariableViewActions">
+         <action
+               style="toggle"
+               id="org.eclipse.objectteams.otdt.internal.debug.adaptor.variableViewActions.ShowOTInternal"
+               class="org.eclipse.objectteams.otdt.internal.debug.adaptor.actions.ShowOTInternalVariablesAction"
+               helpContextId="show_otinternal_action_context"
+               label="%showOTInternalAction.label"
+               menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart"
+               tooltip="%showOTInternalAction.tooltip">
+         </action>
+         <menu
+               id="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu"
+               label="%VariablesViewJavaSubmenu.label"
+               path="javaActions">
+            <groupMarker name="org.eclipse.jdt.debug.ui.javaPart"/>
+         </menu>
+       </viewContribution>
+	</extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.eclipse.objectteams.otdt.internal.debug.adaptor.PreferenceInitializer">
+      </initializer>
+   </extension>
+</plugin>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/DebugMessages.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/DebugMessages.java
new file mode 100644
index 0000000..388aa05
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/DebugMessages.java
@@ -0,0 +1,35 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: DebugMessages.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DebugMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.internal.debug.adaptor.debugMessages"; //$NON-NLS-1$
+	public static String OTLaunching_loading_failed_msg;
+	public static String OTLaunching_OTRE_checkbox_label;
+	public static String OTLaunching_OTRE_group_title;
+	public static String OTLaunching_OTEquinox_checkbox_label;
+	public static String OTLaunching_no_OTJ_project_found;
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, DebugMessages.class);
+	}
+
+	private DebugMessages() {
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/LaunchUtils.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/LaunchUtils.java
new file mode 100644
index 0000000..66f2b35
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/LaunchUtils.java
@@ -0,0 +1,58 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: LaunchUtils.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+
+/** 
+ * Simple queries relating to launches/launch-configs. 
+ * @author stephan
+ * @since 1.2.1 
+ */
+public class LaunchUtils {
+
+	/** Does elem belong to an OT launch? */
+	static boolean isOTLaunch(Object elem) {
+		try {
+			if (!(elem instanceof IDebugElement))
+				return false;
+			ILaunchConfiguration launchConfiguration = ((IDebugElement)elem).getLaunch().getLaunchConfiguration();
+			return launchConfiguration.getAttribute(OTDebugPlugin.OT_LAUNCH, false);
+		} catch (Exception e) {
+			return false;
+		}
+	}
+
+	/** Does projectName denote an OT/J-enabled project? */
+	public static boolean isOTJProject(String projectName) {
+		if (projectName != null && projectName.length() > 0) {
+			IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+			if (project != null && project.exists())
+				try {
+					return project.hasNature(JavaCore.OTJ_NATURE_ID);
+				} catch (CoreException e) { /* ignore */ }
+		}
+		return false;
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/OTDebugAdaptorPlugin.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/OTDebugAdaptorPlugin.java
new file mode 100644
index 0000000..8adc4fd
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/OTDebugAdaptorPlugin.java
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugAdaptorPlugin.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/** This Activator enables the debug adaptor to manage preferences of its own.
+ *  
+ *  @author stephan
+ *  @since 1.2.0
+ */
+public class OTDebugAdaptorPlugin extends AbstractUIPlugin {
+
+	public static final String PLUGIN_ID = "org.eclipse.objectteams.otdt.internal.debug.adaptor"; //$NON-NLS-1$
+	
+	private static OTDebugAdaptorPlugin instance;
+	
+	public OTDebugAdaptorPlugin() {
+		instance = this;
+	}
+
+	public static AbstractUIPlugin getDefault() {
+		return instance; 
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PreferenceInitializer.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PreferenceInitializer.java
new file mode 100644
index 0000000..a7dec9a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PreferenceInitializer.java
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: PreferenceInitializer.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Provide defaults for this plugin's preferences.
+ * 
+ * @author stephan
+ * @since 1.2.0
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+	public static final String PREF_SHOW_OTINTERNAL_VARIABLES = OTDebugAdaptorPlugin.PLUGIN_ID+".show_otinternal_variables"; //$NON-NLS-1$
+
+	@Override
+	public void initializeDefaultPreferences() {
+		IPreferenceStore store = OTDebugAdaptorPlugin.getDefault().getPreferenceStore();
+		store.setDefault(PreferenceInitializer.PREF_SHOW_OTINTERNAL_VARIABLES, false);
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java
new file mode 100644
index 0000000..26b3687
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java
@@ -0,0 +1,325 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: PresentationAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.ISourceReference;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.Member;
+import org.eclipse.jdt.internal.debug.ui.DebugUIMessages;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences;
+
+import base org.eclipse.jdt.internal.debug.core.model.JDIReferenceType;
+import base org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
+import base org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+
+/**
+ * Adapt the String representation of stack frames in the debug view.
+ * 
+ * @author stephan
+ * @since 1.1.7
+ */
+@SuppressWarnings("restriction")
+public team class PresentationAdaptor 
+{
+	enum MethodKind {
+		PLAIN, INITIAL, CHAIN, ORIG, TEAM_WRAPPER, BASE_CALL, LIFT, WHEN, BASE_WHEN, FIELD_ACCESS
+	}
+	
+	@SuppressWarnings("nls")
+	public static final String[] enhancementTypes = {
+		"org.objectteams.Team[]", "int[]", "int", "int", "int", "java.lang.Object[]"
+	};
+
+	// while working for some clients we have an editor that we can use for adapted source lookup:
+	private ThreadLocal<JavaEditor> javaEditor = new ThreadLocal<JavaEditor>();
+	
+	
+	private static PresentationAdaptor instance;
+	public static PresentationAdaptor getInstance() {
+		if (instance == null)
+			instance= new PresentationAdaptor();
+		return instance;
+	}
+	
+	@SuppressWarnings("unchecked")
+	protected class OTJStackFrame playedBy JDIStackFrame 
+	{
+		// === imports: ===
+		boolean isStatic() -> boolean isStatic();
+		int modifiers() -> com.sun.jdi.Method getUnderlyingMethod()
+			with { result <- result.modifiers() }
+
+		// store analyzed method kind between calls:
+		protected MethodKind kind= MethodKind.PLAIN;
+		
+		// == currently unused: ==
+		boolean isRole;
+		boolean isTeam; 
+		
+		protected boolean isPurelyGenerated() {
+			switch(this.kind) {
+			case LIFT:
+			case INITIAL:
+			case CHAIN:
+				return true;
+			}
+			return false;
+		}
+		protected boolean isOTSpecialSrc() {
+			switch(this.kind) {
+			case TEAM_WRAPPER:
+			case BASE_CALL:
+			case WHEN:
+			case BASE_WHEN:
+			case FIELD_ACCESS:
+				return true;
+			}
+			return false;
+		}
+		
+		getTypeName <- replace getReceivingTypeName, getDeclaringTypeName;
+		callin String getTypeName() throws DebugException {
+			return analyzeType(base.getTypeName());
+		}
+		
+		String analyzeType(String typeName) {
+//			this.isRole= typeName.contains("__OT__");
+//			this.isTeam= (modifiers() & 0x8000) != 0;
+//			if (this.isRole)
+				return typeName.replaceAll("__OT__", ""); //$NON-NLS-1$ //$NON-NLS-2$
+//			return typeName;
+		}
+
+		String getMethodName() <- replace String getMethodName();
+		@SuppressWarnings("nls")
+		callin String getMethodName() throws DebugException {
+			String result= base.getMethodName();
+			String[] segments= analyzeMethod(result);
+			if (segments != null) {
+				switch (this.kind) {
+				// INITIAL is not yet analyzed
+				case ORIG: 
+					return segments[1];
+				case CHAIN:
+					return "{{Dispatch callins for "+segments[1]+"}}";
+				case TEAM_WRAPPER:
+					return "["+segments[1]+"."+segments[2]+"<-"+segments[3]+"]";
+				case LIFT:
+					return "{{Lift to "+segments[2]+"}}";
+				case BASE_CALL:
+					return "base."+segments[1];
+				case WHEN:
+					return "[when]";
+				case BASE_WHEN:
+					return "[base when]";
+				case FIELD_ACCESS:
+					return "[access to field "+segments[3]+"]";
+				}
+			}
+			return result;
+		}
+
+		/** Analyze the method name and store the kind.
+		 * @param methodName
+		 * @return an array of segments split at '$'.
+		 */
+		@SuppressWarnings("nls")
+		String[] analyzeMethod(String methodName) 
+		{
+			if (methodName != null && methodName.startsWith("_OT$")) 
+			{
+				String[] segments= methodName.split("[$]");
+				
+				switch (segments.length) {
+				case 2:
+					if      (segments[1].equals("when"))
+						this.kind= MethodKind.WHEN;
+					else if (segments[1].equals("base_when"))
+						this.kind= MethodKind.BASE_WHEN;
+					break;
+				case 3:
+					if      (segments[2].equals("orig"))   // _OT$bm$orig
+						this.kind= MethodKind.ORIG;
+					else if (segments[2].equals("chain"))  // _OT$bm$chain
+						this.kind= MethodKind.CHAIN;
+					else if (segments[1].equals("liftTo")) // _OT$liftTo$R
+						this.kind= MethodKind.LIFT;
+					else if (segments[2].equals("base"))   // _OT$rm$base
+						this.kind= MethodKind.BASE_CALL;
+					break;
+				case 4:
+					if 		(segments[1].equals("_fieldget_")
+						   ||segments[1].equals("_fieldset_"))
+						this.kind = MethodKind.FIELD_ACCESS;
+					else
+						// further analysis needed?
+						this.kind= MethodKind.TEAM_WRAPPER;    // _OT$R$rm$bm
+				}
+				return segments;
+			}
+			return null;
+		}
+		
+		getArgumentTypeNames <- replace getArgumentTypeNames;
+		@SuppressWarnings("rawtypes")
+		callin List getArgumentTypeNames() throws DebugException {
+			return stripGeneratedParams(base.getArgumentTypeNames());
+		}
+				
+		int getLineNumber() <- replace int getLineNumber();
+		callin int getLineNumber() throws DebugException {
+			int result= base.getLineNumber();
+			if (result >= ISMAPConstants.STEP_INTO_LINENUMBER) {
+				if (this.kind == MethodKind.PLAIN) // re-classify, if linenumber was the only unusual property
+					this.kind = MethodKind.INITIAL;
+				return -1;
+			}
+			if (this.kind == MethodKind.CHAIN) {
+				JavaEditor editor = PresentationAdaptor.this.javaEditor.get();
+				if (editor != null) {
+					try {
+						return editor.getStartLineOfEnclosingElement(result-1)+1; // map between 0/1 based counting.
+					} catch (BadLocationException e) {
+						OTDebugAdaptorPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, OTDebugAdaptorPlugin.PLUGIN_ID, "Failed to retrieve line number", e));
+					}
+				}
+			}
+			return result;
+		}
+		
+		// -- helpers --
+		private List<String> stripGeneratedParams(List<String> typeNames) 
+				throws DebugException 
+		{
+			switch (this.kind) {
+			case TEAM_WRAPPER:
+				if (!isStatic())
+					typeNames= typeNames.subList(1, typeNames.size()); // remove role arg
+				break;
+			case BASE_WHEN:
+				typeNames= typeNames.subList(2, typeNames.size()); // remove 2 synth args: dummy,Team
+				break;
+			}
+			// may need to strip multiple sets of enhance-args:
+			List<String> stripped= stripEnhancementParams(typeNames);
+			while (stripped != typeNames) {
+				typeNames= stripped;
+				stripped= stripEnhancementParams(typeNames);
+			}
+			// go into details: strip __OT__ prefix of individual types
+			for (int i=0; i<stripped.size(); i++)
+				stripped.set(i, analyzeType(stripped.get(i)));
+			return stripped;
+		}
+		private List<String> stripEnhancementParams(List<String> typeNames) {
+ 			if (typeNames != null && typeNames.size() >= 6) {
+				for (int i = 0; i < enhancementTypes.length; i++) {
+					if (!enhancementTypes[i].equals(typeNames.get(i)))
+						return typeNames;
+				}
+				return typeNames.subList(6, typeNames.size());
+			}
+			return typeNames;
+		}
+	}
+	/** While assembling the display string (ie., while this team is active) 
+	 *  pretend the "OTJ" stratum is "Java", in order to enable Java name assembly.
+	 */
+	protected class ReferenceType playedBy JDIReferenceType 
+	{
+		String getDefaultStratum() <- replace String getDefaultStratum();
+		callin String getDefaultStratum() throws DebugException {
+			String stratum= base.getDefaultStratum();
+			if (stratum.equals("OTJ"))                     //$NON-NLS-1$
+				return "Java"; // this is where we lie ;-) //$NON-NLS-1$
+			return stratum;
+		}
+	}
+	
+	/** Gateway to java editors for requesting line numbers using info from the java model. */
+	protected class JavaEditor playedBy JavaEditor
+	{
+		@SuppressWarnings("decapsulation")
+		IJavaElement      getElementAt(int offset) -> IJavaElement      getElementAt(int offset);
+		IDocumentProvider getDocumentProvider()    -> IDocumentProvider getDocumentProvider();
+		IEditorInput      getEditorInput()         -> IEditorInput      getEditorInput();
+		
+		protected int getStartLineOfEnclosingElement(int line) throws BadLocationException
+		{
+			IDocument doc = getDocumentProvider().getDocument(getEditorInput());
+			IJavaElement element = getElementAt(doc.getLineOffset(line));
+			if (!(element instanceof ISourceReference))
+				throw new BadLocationException("Element is not an ISourceReference: "+element);
+			try {
+				ISourceRange range = (element instanceof Member)
+						? ((Member) element).getNameRange()
+						: ((ISourceReference) element).getSourceRange();
+				
+				return doc.getLineOfOffset(range.getOffset());
+			} catch (JavaModelException e) {
+				throw new BadLocationException(e.getMessage());
+			}
+		}
+	}
+	
+	/** Answer the symbolic name of the color that should be used for displaying 
+	 *  the given stackframe.
+	 * @param element stackframe
+	 * @return symbolic color name or null.
+	 */
+	public String getFrameColorName(JDIStackFrame as OTJStackFrame element) {
+		if (element.isPurelyGenerated())
+			return OTDebugPreferences.OT_GENERATED_CODE_COLOR;
+		if (element.isOTSpecialSrc())
+			return OTDebugPreferences.OT_SPECIAL_CODE_COLOR;
+		return null;
+	}
+
+	/** 
+	 * When this team is activated in a JavaEditor-aware-context, remember the java editor.
+	 * @param javaEditor new java editor to be remembered, may be null (= reset).
+	 * @return previously remembered editor, may be null. 
+	 */
+	public org.eclipse.jdt.internal.ui.javaeditor.JavaEditor setTextEditor(JavaEditor as JavaEditor javaEditor)
+	{
+		JavaEditor previous = this.javaEditor.get();
+		this.javaEditor.set(javaEditor);
+		return previous;
+	}
+
+	/** Final embellishment of a label after everything has been analyzed. */
+	public String postProcess(JDIStackFrame as OTJStackFrame stackFrame, String labelText) 
+	{
+		if (stackFrame.kind == MethodKind.INITIAL) // this we didn't know when creating the label text			
+			return labelText.replace(DebugUIMessages.JDIModelPresentation_line__76+' '+DebugUIMessages.JDIModelPresentation_not_available, 
+							         "[about to enter]");
+
+		return labelText;
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java
new file mode 100644
index 0000000..65f5268
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java
@@ -0,0 +1,110 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: PresentationAdaptorActivator.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jface.text.source.Annotation;
+
+import base org.eclipse.debug.internal.ui.InstructionPointerManager;
+import base org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
+import base org.eclipse.jdt.internal.debug.ui.JDIModelPresentation;
+
+/**
+ * This team watches over a method from JDTModelPresentation
+ * to enable adaptation of String representations by PresentationAdaptor,
+ * given that the current launch is some OT/J launch.
+ * 
+ * @author stephan
+ * @since 1.1.7
+ */
+@SuppressWarnings("restriction")
+public team class PresentationAdaptorActivator
+{
+	/** Generalized role for different editor-based contexts. */
+	protected class EditorBasedAdaptation 
+	{
+		/** 
+		 * When the current editor is a java editor make it available to the
+		 * to-be-activated {@link PresentationAdaptor}.
+		 * @param textEditor
+		 */
+		callin void adaptedRun(ITextEditor textEditor)
+			when (textEditor instanceof JavaEditor)
+		{
+			PresentationAdaptor adaptor = PresentationAdaptor.getInstance();
+			JavaEditor previous = adaptor.setTextEditor((JavaEditor)textEditor);
+			try {
+				within(adaptor)
+					base.adaptedRun(textEditor);
+			} finally {
+				adaptor.setTextEditor(previous);
+			}			
+		}
+	}
+	/** Let the {@link PresentationAdaptor} adapt positioning of the editor. */
+	protected class EditorPositioningAdaptor extends EditorBasedAdaptation playedBy SourceLookupFacility 
+	{
+		@SuppressWarnings("decapsulation")
+		void adaptedRun(ITextEditor editor) 
+			<- replace void positionEditor(ITextEditor editor, IStackFrame frame)
+			base when (LaunchUtils.isOTLaunch(frame));
+	}
+	/** Let the {@link PresentationAdaptor} adapt positioning of "current instruction" annotations. */
+	protected class AnnotationAdaptor extends EditorBasedAdaptation playedBy InstructionPointerManager
+	{
+		void adaptedRun(ITextEditor textEditor) 
+			<- replace void addAnnotation(ITextEditor textEditor, IStackFrame frame, Annotation annotation)
+			base when (LaunchUtils.isOTLaunch(frame));
+	}
+	/** Let the {@link PresentationAdaptor} adapt composing labels for the debug view. */
+	protected class ModelPresentation playedBy JDIModelPresentation 
+	{
+		String getStackFrameText(IStackFrame frame) <- replace String getStackFrameText(IStackFrame frame)
+			base when (LaunchUtils.isOTLaunch(frame));
+		callin String getStackFrameText(IStackFrame stackFrame) 
+			throws DebugException 
+		{
+			// while constructing the text for a stack frame use the PresentationAdaptor:
+			PresentationAdaptor adaptor = PresentationAdaptor.getInstance();
+			String result;
+			within (adaptor)
+				result = base.getStackFrameText(stackFrame);
+			if (stackFrame instanceof JDIStackFrame)
+				result = adaptor.postProcess((JDIStackFrame)stackFrame, result);
+			return result; 
+		}
+
+		Color getForeground(Object element) <- replace Color getForeground(Object element) 
+			base when (LaunchUtils.isOTLaunch(element));
+		@SuppressWarnings("basecall")
+		callin Color getForeground(Object element) {
+			if (element instanceof JDIStackFrame) {
+				PresentationAdaptor adaptor = PresentationAdaptor.getInstance();
+				String colorName= adaptor.getFrameColorName((JDIStackFrame)element);
+				if (colorName != null)
+					return OTDebugUIPlugin.getPreferenceColor(colorName);
+			}
+			return base.getForeground(element);
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/RetargettableActionAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/RetargettableActionAdaptor.java
new file mode 100644
index 0000000..485ab58
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/RetargettableActionAdaptor.java
@@ -0,0 +1,41 @@
+/**********************************************************************

+ * This file is part of "Object Teams Development Tooling"-Software

+ * 

+ * Copyright 2009 Technical University Berlin, Germany.

+ * 

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ * $Id: RetargettableActionAdaptor.java 23456 2010-02-04 20:44:45Z stephan $

+ * 

+ * Please visit http://www.eclipse.org/objectteams for updates and contact.

+ * 

+ * Contributors:

+ * Technical University Berlin - Initial API and implementation

+ **********************************************************************/

+package org.eclipse.objectteams.otdt.internal.debug.adaptor;

+

+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;

+import org.eclipse.objectteams.otdt.debug.ui.internal.actions.OTToggleBreakpointAdapter;

+

+import base org.eclipse.jdt.internal.debug.ui.actions.RetargettableActionAdapterFactory;

+

+/**

+ * This team replaces the former OTRetargettableActionAdapterFactory class.

+ * 

+ * @author mosconi

+ */

+@SuppressWarnings("restriction")

+public team class RetargettableActionAdaptor {

+	protected class RetargettableActionAdapterFactory playedBy RetargettableActionAdapterFactory {

+	    @SuppressWarnings({ "basecall", "rawtypes" })

+		callin Object getAdapter(Object adaptableObject, Class adapterType) {

+	        if (adapterType == IToggleBreakpointsTarget.class) {

+	            return new OTToggleBreakpointAdapter();

+	        }

+	        return base.getAdapter(adaptableObject, adapterType);

+	    }

+	    getAdapter <- replace getAdapter;

+	}

+}

diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/SourceLookupAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/SourceLookupAdaptor.java
new file mode 100644
index 0000000..661bd75
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/SourceLookupAdaptor.java
@@ -0,0 +1,118 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: RoFiBreakpointTests.java 18812 2008-07-27 18:01:43Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+
+import base org.eclipse.jdt.internal.debug.core.JavaDebugUtils;
+//import base org.eclipse.pde.internal.ui.launcher.PDESourceLookupQuery;
+
+/**
+ * This team makes the PDE source lookup aware of role files.
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class SourceLookupAdaptor {
+
+	// field stored in the team, because intercepted base method generateSourceName() has static context.
+	Object currentElement;
+	
+//	/** 
+//	 * This role is needed because its base class over-eagerly discards
+//	 * the names of inner classes when looking for the source file. 
+//	 */
+//	protected class PDESourceLookupQuery playedBy PDESourceLookupQuery {
+//		
+//		@SuppressWarnings("decapsulation")
+//		Object getFElement() -> get Object fElement;
+//		
+//		keepElement <- before run;
+//		void keepElement() {
+//			currentElement = getFElement();			
+//		}
+//		
+//		@SuppressWarnings("decapsulation")
+//		String generateSourceName(String qualifiedTypeName) <- replace String generateSourceName(String qualifiedTypeName);
+//
+//		@SuppressWarnings("basecall")
+//		static callin String generateSourceName(String qualifiedTypeName) {
+//			try {
+//				return JavaDebugUtils.getSourceName(currentElement);
+//			} catch (CoreException e) {
+//				OTDebugAdaptorPlugin.getDefault().getLog().log(new Status(Status.ERROR, OTDebugAdaptorPlugin.PLUGIN_ID, "Source lookup failed", e));
+//				return base.generateSourceName(qualifiedTypeName);
+//			}
+//		}
+//	}
+	
+	protected class JavaDebugUtils playedBy JavaDebugUtils 
+	{
+		String getSourceName(Object object) -> String getSourceName(Object object);		
+		
+		// FIXME(SH): workaround, problem with overload between callin and inferred callout
+		IType resolveType(String qualifiedName, IJavaElement javaElement) 
+		-> IType resolveType(String qualifiedName, IJavaElement javaElement);
+	
+		IType resolveType(IJavaType type) <- replace IType resolveType(IJavaType type);
+
+		@SuppressWarnings({ "basecall", "inferredcallout" })
+		static callin IType resolveType(IJavaType type) throws CoreException {
+			// copied from base method:
+	    	IJavaElement element = resolveJavaElement(type, type.getLaunch());
+	    	if (element != null ) {
+	    		IType result = resolveType(type.getName(), element);
+	    		// start OT-adaptation: check result:
+	    		if (result != null && result.exists())
+	    			return result;
+	    		// the given compilation unit doesn't have a type `type.getName()`
+	    		try {
+		    		ICompilationUnit resolvedCU = (ICompilationUnit) element;
+		    		String typeName = type.getName();
+		    		int lastDollar = typeName.lastIndexOf('$');
+		    		if (lastDollar != -1) {
+		    			// find a type that is (a) superclass of `type` and (b) contained in `resolvedCU`
+		    			String enclosingName = typeName.substring(0, lastDollar);
+		    			IJavaProject javaProject = resolvedCU.getJavaProject();
+						IType enclosingType = javaProject.findType(enclosingName);
+		    			while (enclosingType != null) {
+		    				if (resolvedCU.equals(enclosingType.getAncestor(IJavaElement.COMPILATION_UNIT))) {
+		    					// got the enclosing team, now find the corresponding role:
+		    					String roleName = typeName.substring(lastDollar+1);
+		    					if (roleName.startsWith(IOTConstants.OT_DELIM))
+		    						roleName = roleName.substring(IOTConstants.OT_DELIM_LEN);
+								return enclosingType.getType(roleName);
+		    				}
+		    				String[][] superclassName = enclosingType.resolveType((enclosingType.getSuperclassName()));
+							enclosingType = javaProject.findType(superclassName[0][0], superclassName[0][1]);
+		    			}
+		    		}
+	    		} catch (Exception e) {
+	    			return null;
+	    		}
+	    	}
+	    	return null;
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java
new file mode 100644
index 0000000..082aee7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java
@@ -0,0 +1,131 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2007, 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: VariablesViewAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.debug.core.IJavaFieldVariable;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.actions.ShowOTInternalVariablesAction;
+
+import base org.eclipse.debug.internal.ui.model.elements.StackFrameContentProvider;
+import base org.eclipse.debug.internal.ui.model.elements.VariableContentProvider;
+
+/**
+ * Implements variables filtering for VariablesView and TeamView.
+ * <ul>
+ * <li>TeamView always filters statics.</li>
+ * <li>Conditionally filter internal OT/J variables (starting with _OT$); 
+ *     This filter is controlled by view specific preferences.</li>
+ * </ul>
+ * 
+ * @author stephan
+ * @since 1.1.6
+ */
+@SuppressWarnings("restriction")
+public team class VariablesViewAdaptor 
+{
+	/** Adapt the content provider for root elements of the variables view. */
+	protected class StackFrameContentProvider playedBy StackFrameContentProvider {
+
+		Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor) 
+			<- replace Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor);
+
+		callin Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor) 
+				throws CoreException 
+		{
+			Object[] rawChildren = base.getAllChildren(parent, context, monitor);
+	        
+			if (!context.getId().equals(IDebugUIConstants.ID_VARIABLE_VIEW))
+	        	return rawChildren;
+	        
+			// is filtering needed?
+        	if (ShowOTInternalVariablesAction.includeOTInternal(context))
+				return rawChildren;
+
+        	// at this point always filter internals, but toplevel never has statics to filter:
+	        return filterChildren(rawChildren, true/*OTInternals*/, false/*statics*/); 
+		}
+		
+	}
+
+	/** Adapt the content provider for non-toplevel elements. */
+	protected class ContentProvider playedBy VariableContentProvider 
+	{
+		Object[] getValueChildren(IDebugElement parent, IValue value, IPresentationContext context) 
+		<- replace Object[] getValueChildren(IDebugElement parent, IValue value, IPresentationContext context);
+
+		callin Object[] getValueChildren(IDebugElement parent, IValue value, IPresentationContext context)
+				throws CoreException 
+		{
+			Object[] rawChildren = base.getValueChildren(parent, value, context);
+			
+			// is filtering needed?
+			boolean filterOTInternals = ! ShowOTInternalVariablesAction.includeOTInternal(context);		
+			
+			// TeamView constantly filters statics:
+			boolean filterStatics = context.getId().equals(OTDebugUIPlugin.TEAM_VIEW_ID);
+			
+			if (filterOTInternals || filterStatics)			
+				return filterChildren(rawChildren, filterOTInternals, filterStatics);
+			
+			return rawChildren;
+		}
+
+	}
+	
+	/**
+	 * Filter from rawChildren ot-internal variables and/or static fields.
+	 */
+	static Object[] filterChildren(Object[] rawChildren, boolean filterOTInternals, boolean filterStatics) {
+		List<Object> visible = new ArrayList<Object>();
+		
+		for (int i= 0; i<rawChildren.length; i++)
+			if (!isFiltered((IVariable)rawChildren[i], filterOTInternals, filterStatics))
+				visible.add(rawChildren[i]);
+		
+		// has filtering taken place?
+		if (visible.size() == rawChildren.length)
+			return rawChildren;
+		return visible.toArray(new Object[visible.size()]);
+	}
+	// helper checking conditions for above method:
+	static boolean isFiltered(IVariable var, boolean filterOTInternals, boolean filterStatics) {
+		try {
+			if (filterOTInternals && var.getName().startsWith(IOTConstants.OT_DOLLAR))
+				return true;
+			if (filterStatics && var instanceof IJavaFieldVariable)
+				if (((IJavaFieldVariable)var).isStatic())
+					return true;
+		} catch (DebugException e) {
+			return true; // cannot display any way.
+		}
+		return false;
+	}
+	
+	
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java
new file mode 100644
index 0000000..f0643d6
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ShowOTInternalVariablesAction.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.actions;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jdt.internal.debug.ui.actions.ToggleBooleanPreferenceAction;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.OTDebugAdaptorPlugin;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.PreferenceInitializer;
+
+/**
+ * Toggle action for filtering OT-Internal variables (starting with "_OT$").
+ * This action can be used by different views (currently: TeamView and VariablesView).
+ * 
+ * @author stephan
+ * @since 1.2.0
+ */
+@SuppressWarnings("restriction")
+public class ShowOTInternalVariablesAction extends ToggleBooleanPreferenceAction {
+
+	public ShowOTInternalVariablesAction() {
+		super();
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#getPreferenceKey()
+	 */
+	protected String getPreferenceKey() {
+		return PreferenceInitializer.PREF_SHOW_OTINTERNAL_VARIABLES; 
+	}
+	
+	protected IPreferenceStore getPreferenceStore() {
+		return OTDebugAdaptorPlugin.getDefault().getPreferenceStore();
+	}
+	
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.ui.actions.ToggleBooleanPreferenceAction#getViewKey()
+	 */
+	protected String getViewKey() {
+		return getCompositeKey();
+	}
+
+	public static boolean includeOTInternal(IPresentationContext context){
+		IPreferenceStore store = OTDebugAdaptorPlugin.getDefault().getPreferenceStore();
+		String key = context.getId() + "." + PreferenceInitializer.PREF_SHOW_OTINTERNAL_VARIABLES; //$NON-NLS-1$
+		return store.getBoolean(key);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/debugMessages.properties b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/debugMessages.properties
new file mode 100644
index 0000000..fe10c2c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/debugMessages.properties
@@ -0,0 +1,5 @@
+OTLaunching_loading_failed_msg=Unable to read from launch configuration
+OTLaunching_OTRE_checkbox_label=Enable OTRE
+OTLaunching_OTEquinox_checkbox_label=Enable OT/Equinox
+OTLaunching_OTRE_group_title=Object Teams Runtime
+OTLaunching_no_OTJ_project_found=No OT/J plug-in project found, debug functionality not fully available.
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor.java
new file mode 100644
index 0000000..e551404
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor.java
@@ -0,0 +1,105 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: DebugUIDialogAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.pde.internal.ui.IPDEUIConstants;
+
+import base org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import base org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer;
+import base org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog;
+
+/**
+ * This team conditionally adds the "Team Activation" tab to the launch configuration dialog.
+ * Only the most specific subteam is activated.
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class DebugUIDialogAdaptor {
+
+	
+	protected class LaunchConfigurationTabGroup playedBy AbstractLaunchConfigurationTabGroup {
+
+		boolean isOTJlaunch = false;
+		
+		/** Catch the dialog to find out if the current launch is ot-enabled. */
+		void checkProject(LaunchConfigurationsDialog dialog) 
+				<- before void createTabs(ILaunchConfigurationDialog dialog, String mode)
+				with { dialog <- (LaunchConfigurationsDialog)dialog } 
+		void checkProject(LaunchConfigurationsDialog dialog) {
+			isOTJlaunch = dialog != null && dialog.isOTJlaunch();
+		}
+
+		/** Intercept installation of the tabs, as to conditionally insert our tab. */
+		void setTabs(ILaunchConfigurationTab[] tabs) <- replace void setTabs(ILaunchConfigurationTab[] tabs)
+				when(this.isOTJlaunch && tabs != null);
+		callin void setTabs(ILaunchConfigurationTab[] tabs) {
+			int len = tabs.length;
+			int insertPos = tabs.length;
+			for(int i=0; i<len; i++) {
+				if (tabs[i] instanceof AbstractLaunchConfigurationTab) {
+					AbstractLaunchConfigurationTab launchConfigurationTab = (AbstractLaunchConfigurationTab)tabs[i];
+					if ("org.eclipse.jdt.debug.ui.javaArgumentsTab".equals(launchConfigurationTab.getId())) { //$NON-NLS-1$
+						insertPos = i+1;
+						break;
+					}
+				} else if (tabs[i] instanceof OTLaunchConfigurationTab) {
+					base.setTabs(tabs); // already present, don't insert again (for legacy launches).
+					return;
+				}
+			}
+			ILaunchConfigurationTab[] newTabs = new ILaunchConfigurationTab[len+1];
+			for (int i=0,j=0; j<=len; j++)
+				if (j != insertPos)
+					newTabs[j] = tabs[i++];
+			newTabs[insertPos] = new OTLaunchConfigurationTab();
+			base.setTabs(newTabs);
+		}
+	}
+	/** Gate to base-level information, here: whether current launch is ot-enabled. */
+	protected class LaunchConfigurationsDialog playedBy LaunchConfigurationsDialog 
+	{
+		@SuppressWarnings("decapsulation")
+		LaunchConfigurationTabGroupViewer getTabViewer() -> LaunchConfigurationTabGroupViewer getTabViewer();
+		
+		protected boolean isOTJlaunch() {
+			LaunchConfigurationTabGroupViewer viewer = getTabViewer();
+			if (viewer == null) return false;
+			ILaunchConfigurationWorkingCopy workingCopy = viewer.getWorkingCopy();
+			if (workingCopy == null) return false;
+			try {
+				return workingCopy.getAttribute(OTDebugPlugin.OT_LAUNCH, false)
+					&& workingCopy.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String)null) == null;
+			} catch (CoreException e) {
+				return false;
+			}
+		}
+	}
+	/** Only exposing one inaccessible method. */
+	protected class LaunchConfigurationTabGroupViewer playedBy LaunchConfigurationTabGroupViewer {
+		@SuppressWarnings("decapsulation")
+		ILaunchConfigurationWorkingCopy getWorkingCopy() -> ILaunchConfigurationWorkingCopy getWorkingCopy();
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor2.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor2.java
new file mode 100644
index 0000000..23c50e2
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor2.java
@@ -0,0 +1,35 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: DebugUIDialogAdaptor2.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import base org.eclipse.jdt.internal.debug.ui.launcher.LocalJavaApplicationTabGroup;
+
+/**
+ * Apply adaptations of the super team to a class from org.eclipse.jdt.debug.ui.
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class DebugUIDialogAdaptor2 extends DebugUIDialogAdaptor {
+	protected class JDTTabGroup
+			extends LaunchConfigurationTabGroup
+			playedBy LocalJavaApplicationTabGroup 
+	{
+		// empty role, just advise OT/Equinox to weave into one more base class. See Trac #145
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor3.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor3.java
new file mode 100644
index 0000000..81d475a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/DebugUIDialogAdaptor3.java
@@ -0,0 +1,35 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: DebugUIDialogAdaptor3.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import base org.eclipse.jdt.internal.junit.launcher.JUnitTabGroup;
+
+/**
+ * Apply adaptations of the super team to a class from org.eclipse.jdt.junit
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class DebugUIDialogAdaptor3 extends DebugUIDialogAdaptor2 {
+	protected class JUnitTabGroup 
+			extends LaunchConfigurationTabGroup
+			playedBy JUnitTabGroup
+	{
+		// empty, just advise OT/Equinox to weave into one more base class. See Trac #145
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTDebugUILaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTDebugUILaunchingAdaptor.java
new file mode 100644
index 0000000..a7fbbf8
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTDebugUILaunchingAdaptor.java
@@ -0,0 +1,136 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: JDTDebugUILaunchingAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.internal.debug.ui.jres.JREsComboBlock;
+import org.eclipse.objectteams.otdt.debug.IOTLaunchConstants;
+import org.eclipse.objectteams.otdt.ui.OTDTUIPlugin;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+
+import base org.eclipse.jdt.debug.ui.launchConfigurations.JavaConnectTab;
+import base org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
+
+/**
+ * This team adds a new section to the JRE tab containing
+ * <ul> 
+ * <li>a checkbox "Enable OTRE"
+ * <li>a checkbox "Use JPLIS (experimental)"
+ * </ul>
+ * If this box is enabled, launching will happen in OT/J mode, which is
+ * managed by the {@link JDTLaunchingAdaptor}.
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class JDTDebugUILaunchingAdaptor {
+
+	/**
+	 * Adds the "use JPLIS" option to an OTREBlock, and also connects the OTREBlock to its base.
+	 */
+	protected class JavaJRETab extends OTREBlock playedBy JavaJRETab {
+
+		Button _jplisToggleButton;
+		boolean _useJPLIS = true;
+		
+		// === Imports (callout) : ===
+		@SuppressWarnings("decapsulation")
+		Control getJREControl() -> get JREsComboBlock fJREBlock
+			with { result <- fJREBlock.getControl() }
+
+		@SuppressWarnings("decapsulation")
+		Button createCheckButton(Composite arg0, String arg1) -> Button createCheckButton(Composite arg0, String arg1);
+		
+		@SuppressWarnings("decapsulation")
+		void setDirty(boolean dirty) -> void setDirty(boolean dirty);
+
+		@SuppressWarnings("decapsulation")
+		void updateLaunchConfigurationDialog() -> void updateLaunchConfigurationDialog();
+		
+		// build the GUI:
+		Group createOTRESection(Composite parent) <- after void createControl(Composite parent);
+		public Group createOTRESection(Composite parent) {
+			Composite enclosingComposite = (Composite) this.getJREControl();
+			Group group = super.createOTRESection(enclosingComposite, true/*useSWTFactory*/);
+	        this._jplisToggleButton = createCheckButton(group, OTDTUIPlugin.getResourceString("OTJavaMainTab.jplis_checkbox_label")); //$NON-NLS-1$
+	        this._jplisToggleButton.addSelectionListener(new SelectionAdapter() 
+		        {
+		            public void widgetSelected(SelectionEvent e)
+		            {
+		                JavaJRETab.this._useJPLIS = JavaJRETab.this._jplisToggleButton.getSelection();
+		                setDirty(true);
+		                updateLaunchConfigurationDialog();
+		            }
+		        });
+			return group;
+		}
+		
+		// read stored value:
+		void initializeFrom(ILaunchConfiguration config) <- after void initializeFrom(ILaunchConfiguration config);
+		
+		protected void tryInitializeFrom(ILaunchConfiguration config, boolean hasOTJProject) throws CoreException {
+			super.tryInitializeFrom(config, hasOTJProject);
+			this._jplisToggleButton.setEnabled(hasOTJProject);
+			this._useJPLIS = config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, this._useJPLIS);
+			this._jplisToggleButton.setSelection(this._useJPLIS);
+		}
+		
+		// apply value change:
+		void performApply(ILaunchConfigurationWorkingCopy config) 
+				<- after void performApply(ILaunchConfigurationWorkingCopy config);
+		public void performApply(ILaunchConfigurationWorkingCopy config) {
+	     	super.performApply(config);
+	     	config.setAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, this._useJPLIS);
+	    }
+	}
+	
+	/** Add an OTRE block to the "Connect" tab for remote debugging. */
+	@SuppressWarnings("decapsulation")
+	protected class JavaConnectTab extends OTREBlock playedBy JavaConnectTab {
+
+		Control getControl() -> Control getControl();
+
+		void createVerticalSpacer(Composite comp, int colSpan) -> void createVerticalSpacer(Composite comp, int colSpan);
+
+		Button createCheckButton(Composite parent, String label) -> Button createCheckButton(Composite parent, String label);
+
+		void setDirty(boolean dirty) -> void setDirty(boolean dirty);
+
+		void updateLaunchConfigurationDialog() -> void updateLaunchConfigurationDialog();
+
+		// build the GUI:
+		Group createOTRESection(Composite parent) <- after void createControl(Composite parent);
+		public Group createOTRESection(Composite parent) {
+			Composite enclosingComposite = (Composite) this.getControl();
+			createVerticalSpacer(enclosingComposite, 10);
+			Group group = super.createOTRESection(enclosingComposite, true/*useSWTFactory*/);
+			return group;
+		}
+		
+		// hook the trigger for passing the ot-launch attribute:
+		void performApply(ILaunchConfigurationWorkingCopy config) 
+			<- after void performApply(ILaunchConfigurationWorkingCopy config);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
new file mode 100644
index 0000000..397e514
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
@@ -0,0 +1,209 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: JDTLaunchingAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
+import org.eclipse.objectteams.otdt.core.ext.OTRuntimeClasspathProvider;
+import org.eclipse.objectteams.otdt.debug.IOTLaunchConstants;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.objectteams.otdt.debug.OTVMRunnerAdaptor;
+import org.eclipse.objectteams.otdt.debug.TeamBreakpointInstaller;
+import org.eclipse.pde.internal.ui.IPDEUIConstants;
+
+import base org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import base org.eclipse.jdt.launching.StandardClasspathProvider;
+
+/**
+ * This team observes java launches and potentially modifies them for OT/J capabilities.
+ * <ul>
+ * <li>Add BCEL and JMangler to the classpath (role {@link ClasspathExtender})
+ * <li>Maintain an OTVMRunnerAdaptor for adapting vm- and program args (role {@link JDTLaunchingAdaptor.AbstractJavaLaunchConfigurationDelegate}).
+ * </ul>
+ * Role {@link JDTLaunchingAdaptor.JavaLaunchDelegate} only binds the above behavior into Java launches.
+ * See {@link JUnitLaunchingAdaptor.JUnitLaunchConfigurationDelegate} for equal binding to JUnit launches.
+ *  
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class JDTLaunchingAdaptor {
+
+	/**
+	 * This role extends the classpath with BCEL and JMangler paths if OT/J is enabled for the launch.
+	 */
+	protected class ClasspathExtender playedBy StandardClasspathProvider {
+
+		IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration config) 
+				<- replace IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration config);
+
+		callin IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration config) throws CoreException 
+		{
+	    	IRuntimeClasspathEntry[] origEntries = base.computeUnresolvedClasspath(config);
+	    	
+	    	boolean useJMangler = isNormalOTJLaunch(config);
+	    	if (!useJMangler && !isJPLISOTJLaunch(config))
+	    		return origEntries;
+	    	
+	    	// add BCEL, JMangler-core and JMangler-start (classpath / bootclasspath)
+	    	int oldLength = origEntries.length;
+			IRuntimeClasspathEntry[] otRuntimeEntries = computePathsToAdd(origEntries, useJMangler);
+			
+			// merge results:
+	    	IRuntimeClasspathEntry[] result = new IRuntimeClasspathEntry[oldLength + otRuntimeEntries.length];
+			System.arraycopy(origEntries, 0, result, 0, oldLength);
+			System.arraycopy(otRuntimeEntries, 0, result, oldLength, otRuntimeEntries.length);
+	        return result;
+		}
+		
+	    static IRuntimeClasspathEntry[] computePathsToAdd( IRuntimeClasspathEntry[] origEntries, boolean useJMangler )
+		{
+			boolean hasBCEL = false;
+			boolean hasJManglerCore = false;
+			boolean hasJManglerStart = false;
+			boolean hasOTRE_min = false;
+	
+			for (int i = 0; i < origEntries.length; i++)
+	        {
+	            IRuntimeClasspathEntry entry = origEntries[i];
+				if (OTRuntimeClasspathProvider.BCEL_JAR.equals(entry.getPath()))
+					hasBCEL = true;
+				else if (OTREContainer.OTRE_JAR_PATH.equals(entry.getPath().toString()))
+					hasOTRE_min = true;
+	        }
+	
+			List<IRuntimeClasspathEntry> result = new LinkedList<IRuntimeClasspathEntry>();
+			IRuntimeClasspathEntry entry;
+	
+			if (!hasBCEL) {
+				entry = JavaRuntime.newArchiveRuntimeClasspathEntry(OTRuntimeClasspathProvider.BCEL_JAR);
+				entry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
+				result.add(entry);			
+			}
+	
+			if (!hasJManglerCore && useJMangler) {
+				throw new RuntimeException("JMangler is no longer supported");
+			}  
+			
+			if (!hasJManglerStart && useJMangler) { 	
+				throw new RuntimeException("JMangler is no longer supported");			
+			}		    	
+			
+			if (!hasOTRE_min && !useJMangler) {
+				entry = JavaRuntime.newArchiveRuntimeClasspathEntry(JavaCore.getResolvedVariablePath(new Path(OTREContainer.OTRE_MIN_JAR_PATH)));
+				entry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
+				result.add(entry);
+			}
+			
+			return result.toArray(new IRuntimeClasspathEntry[result.size()]);
+		}
+
+	}
+	
+	/**
+	 * This role performs the adaptations of vmargs and program args (including main class name).
+	 */
+	protected class AbstractJavaLaunchConfigurationDelegate playedBy AbstractJavaLaunchConfigurationDelegate 
+	{
+		IJavaProject getJavaProject(ILaunchConfiguration arg0) -> IJavaProject getJavaProject(ILaunchConfiguration arg0);
+
+		OTVMRunnerAdaptor fAdaptor;
+		boolean useJMangler = false;
+		String fOriginalMain;
+
+		// --- Initiate adaptations: (this callin actually applies to sub-base-classes)
+		void prepareLaunch(ILaunchConfiguration config, String mode, ILaunch launch)
+				<- before void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor);
+		void prepareLaunch(ILaunchConfiguration config, String mode, ILaunch launch) throws CoreException 
+		{
+			this.fOriginalMain = null; // reset potential left over from previous launching
+			this.useJMangler = isNormalOTJLaunch(config);
+			if (!this.useJMangler && !isJPLISOTJLaunch(config)) {
+				this.fAdaptor = null;
+				return;
+			}
+			this.fAdaptor = new OTVMRunnerAdaptor();
+			this.fAdaptor.setAdaptationArgs(config, mode, launch);
+			// install OT-breakpoints
+			if (ILaunchManager.DEBUG_MODE.equals(mode))
+				TeamBreakpointInstaller.installTeamBreakpoints(getJavaProject(config));
+		}
+
+		// --- Main Type Name: ---
+		String verifyMainTypeName(ILaunchConfiguration config) 
+				<- replace String verifyMainTypeName(ILaunchConfiguration config)
+			when (this.useJMangler);
+
+		callin String verifyMainTypeName(ILaunchConfiguration config) throws CoreException {
+			throw new RuntimeException("JMangler is no longer supported");
+		}
+
+		// --- VM Arguments: ---
+		String getVMArguments(ILaunchConfiguration configuration) 
+				<- replace String getVMArguments(ILaunchConfiguration configuration)
+			when (this.fAdaptor != null);
+
+
+		callin String getVMArguments(ILaunchConfiguration config) throws CoreException {
+			String vmArgs = base.getVMArguments(config);
+			return this.fAdaptor.adaptVMArgumentString(vmArgs);
+		}
+
+		// --- Program Arguments: ---
+		String getProgramArguments(ILaunchConfiguration config) 
+				<- replace String getProgramArguments(ILaunchConfiguration config)
+			when (this.fOriginalMain != null);
+
+		callin String getProgramArguments(ILaunchConfiguration config) throws CoreException {
+			String programArguments = base.getProgramArguments(config);
+			return this.fOriginalMain + ' ' + programArguments;
+		}		
+	}
+	
+	static boolean isNormalOTJLaunch(ILaunchConfiguration config) {
+		try {
+			return    config.getAttribute(OTDebugPlugin.OT_LAUNCH, false)                               // OT/J ?
+				  && !config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, false)					    // not JPLIS ?
+				  && (config.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String)null) == null); // not PDE ?
+		} catch (CoreException e) {
+			return false; // don't apply adaptations to bogus config
+		}
+	}
+		
+	static boolean isJPLISOTJLaunch(ILaunchConfiguration config) {
+		try {
+			return    config.getAttribute(OTDebugPlugin.OT_LAUNCH, false)                               // OT/J ?
+				  &&  config.getAttribute(IOTLaunchConstants.ATTR_USE_JPLIS, false)					    // JPLIS ?
+				  && (config.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String)null) == null); // not PDE ?
+		} catch (CoreException e) {
+			return false; // don't apply adaptations to bogus config
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JUnitLaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JUnitLaunchingAdaptor.java
new file mode 100644
index 0000000..1c5b3ef
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JUnitLaunchingAdaptor.java
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: JUnitLaunchingAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import base org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate;
+
+/**
+ * This team hooks the adaptation of its super team into JUnit launches.
+ * Note, that only an instance of this sub-team is activated a boot-time.
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+public team class JUnitLaunchingAdaptor extends JDTLaunchingAdaptor {
+
+	protected class JUnitLaunchConfigurationDelegate
+			extends AbstractJavaLaunchConfigurationDelegate
+			playedBy JUnitLaunchConfigurationDelegate 
+	{
+		// empty: this role only helps OT/Equinox so that it will weave into an overriding method.
+		//        all adaptations are defined in the super role.
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/LaunchConfigurationInitializer.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/LaunchConfigurationInitializer.java
new file mode 100644
index 0000000..8ca229a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/LaunchConfigurationInitializer.java
@@ -0,0 +1,81 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: LaunchConfigurationInitializer.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.LaunchUtils;
+
+import base org.eclipse.debug.internal.core.LaunchConfigurationType;
+import base org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy;
+
+/**
+ * This team observes creation of launch configurations and initializes the 
+ * org.eclipse.objectteams.launch attribute accordingly.
+ * 
+ * @author stephan
+ * @since 1.2.1
+ */
+@SuppressWarnings("restriction")
+public team class LaunchConfigurationInitializer {
+
+	/** 
+	 * Observe creation of new instances.
+	 */
+	protected class LaunchConfigurationType playedBy LaunchConfigurationType {
+
+		void acceptInstance(LaunchConfigWC inst) 
+			<- after ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name)
+			with { inst <- (LaunchConfigurationWorkingCopy)result }
+
+		void acceptInstance(LaunchConfigWC inst) {
+			// nop, just lifting. Role will take over.
+		}
+	}
+	
+	/** 
+	 * While an instance is still new (= role exists) wait for the project name to be set.
+	 */
+	protected class LaunchConfigWC playedBy LaunchConfigurationWorkingCopy
+			base when (LaunchConfigurationInitializer.this.hasRole(base, LaunchConfigWC.class))
+	{
+		// callout interface:
+		boolean getAttribute(String key, boolean dflt) -> boolean getAttribute(String key, boolean dflt);
+		void setAttribute(String key, boolean val)     -> void setAttribute(String key, boolean val);
+		
+		void setAttribute(String key, String value) <- after void setAttribute(String key, String value);
+		void setAttribute(String key, String value) {
+			if (key.equals(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME)) {
+				try {
+					if (   LaunchUtils.isOTJProject(value)
+						&& !getAttribute(OTDebugPlugin.OT_LAUNCH, false))
+					{
+						setAttribute(OTDebugPlugin.OT_LAUNCH, true);
+					}
+				} catch (CoreException e) {
+					OTDebugPlugin.getExceptionHandler().logException("Error getting a launch configuration attribute", e); //$NON-NLS-1$
+				}
+				// this role has served its purpose - unregister now:
+				LaunchConfigurationInitializer.this.unregisterRole(this, LaunchConfigWC.class);
+			}
+			return;
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTLaunchConfigurationTab.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTLaunchConfigurationTab.java
new file mode 100644
index 0000000..bc85d8c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTLaunchConfigurationTab.java
@@ -0,0 +1,216 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2009 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTLaunchConfigurationTab.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.debug.IOTLaunchConstants;
+import org.eclipse.objectteams.otdt.ui.ImageConstants;
+import org.eclipse.objectteams.otdt.ui.ImageManager;
+import org.eclipse.objectteams.otdt.ui.OTDTUIPlugin;
+
+/**
+ * This class provides the "Team Activation" tab to the launch dialog.
+ * 
+ * @author gis
+ * @version $Id: OTLaunchConfigurationTab.java 23456 2010-02-04 20:44:45Z stephan $
+ */
+public class OTLaunchConfigurationTab extends AbstractLaunchConfigurationTab implements ILaunchConfigurationTab
+{
+	private List<IType> _teamModel = new ArrayList<IType>();
+    
+    private TeamConfig _teamConfig;
+    private IProject _project = null;
+	
+    public void createControl(Composite parent)
+    {
+       	_teamConfig = new TeamConfig(parent, SWT.NONE, this);
+    	setControl(_teamConfig);
+    	setMessage(OTDTUIPlugin.getResourceString("TeamConfig.cannot_instantiate_message")); //$NON-NLS-1$
+    }
+
+    public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
+    {
+        // nothing to do -- empty defaults
+    }
+
+    public void initializeFrom(ILaunchConfiguration configuration)
+    {
+        _teamModel.clear();
+        
+    	List teamHandles = new LinkedList(); 
+    	boolean teamsActive = true;
+    	try {
+			teamHandles =  configuration.getAttribute(IOTLaunchConstants.ATTR_TEAMCONFIG_LIST, teamHandles);	
+			teamsActive = configuration.getAttribute(IOTLaunchConstants.ATTR_TEAMCONFIG_ACTIVE, true);
+		} catch (CoreException ce) {
+		    OTDTUIPlugin.getExceptionHandler().logCoreException("Cannot read team configuration", ce); //$NON-NLS-1$
+		}
+
+		_teamConfig.clearTeamList();
+		List<String> badTeams = new LinkedList<String>();
+		for (Iterator iter = teamHandles.iterator(); iter.hasNext();) {
+			String teamHandle = (String) iter.next();
+			IType type = (IType) JavaCore.create(teamHandle);
+			if (type != null)
+			{
+			    if (type.exists())
+			    {
+			        IOTType otType = OTModelManager.getOTElement(type);
+			        if (otType != null)
+			        {
+			            _teamModel.add(otType);
+			            continue;
+			        }
+			    }
+            	badTeams.add(type.getFullyQualifiedName());
+			}
+			else
+			    badTeams.add(teamHandle);
+		}
+
+		reportBadTeams(badTeams);
+		
+		_teamConfig.setActive(teamsActive);
+		_teamConfig.setTeamInput(_teamModel);
+		_teamConfig.checkEnablement();
+		
+		String projectName = getProjectFromConfig(configuration);
+		if (projectName.length() != 0)
+		    _project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+		else
+		    _project = null;
+    }
+
+    private void reportBadTeams(List<String> badTeams)
+    {
+        // TODO (carp): ideally, we need some sort of listener that notices renaming and deleting of classes
+        // so that the launch configuration can be updated.
+        if (!badTeams.isEmpty())
+		{
+		    StringBuffer message = new StringBuffer(OTDTUIPlugin.getResourceString("TeamConfig.not_found_message")); //$NON-NLS-1$
+		    for (Iterator<String> iter = badTeams.iterator(); iter.hasNext();)
+            {
+                String badTeam = iter.next();
+                message.append(badTeam + '\n');
+            }
+		    setModified(); // otherwise, the bad configuration will be kept!
+		    setErrorMessage(message.toString()); // this should actually be a warning, not an error
+		}
+    }
+
+    public void performApply(ILaunchConfigurationWorkingCopy configuration)
+    {
+    	removeUnavailableTeamsErrorMessage(); // not really 
+    	
+        List<String> teamHandles = getTeamModelAsHandles();
+
+    	configuration.setAttribute(IOTLaunchConstants.ATTR_TEAMCONFIG_LIST, teamHandles);
+    	configuration.setAttribute(IOTLaunchConstants.ATTR_TEAMCONFIG_ACTIVE, _teamConfig.isActive());
+    }
+
+    private void removeUnavailableTeamsErrorMessage()
+    {
+        // well, actually this removes any error message of this tab, but this is our
+        // only one, so far (and actually should be a warning instead of an error)
+        setErrorMessage(null);
+    	getLaunchConfigurationDialog().updateMessage();
+    }
+
+    public String getName()
+    {
+    	return OTDTUIPlugin.getResourceString("TeamConfig.tab_title"); //$NON-NLS-1$
+    }
+    
+    public Image getImage() 
+    {
+    	return ImageManager.getSharedInstance().get(ImageConstants.TEAM_IMG);
+    }
+
+	/**
+	 * 
+	 */
+	public void setModified() 
+	{
+		setDirty(true);
+		updateLaunchConfigurationDialog();
+	}
+	
+	private String getProjectFromConfig(ILaunchConfiguration config) 
+	{
+		String projectName= ""; //$NON-NLS-1$
+		try {
+			projectName= config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");	 //$NON-NLS-1$
+		} catch (CoreException ce) {
+			OTDTUIPlugin.getExceptionHandler().logCoreException("Unable to retrieve _project from launch configuration", ce); //$NON-NLS-1$
+		}
+		return projectName;
+	}
+
+	public IProject getProject() {
+		return _project;
+	}
+	
+	public List<IType> getTeamModel()
+    {
+        return _teamModel;
+    }
+
+    /**
+     * Converts the List<IOTType> _teamModel to a new List<String>, consisting of all
+     * ITypes' HandleIdentifiers.
+     * @return the new list
+     */
+    private List<String> getTeamModelAsHandles()
+    {
+        List<String> teamHandles = new LinkedList<String>();
+        for (Iterator<IType> iter = _teamModel.iterator(); iter.hasNext();)
+        {
+            IType type = iter.next();
+            teamHandles.add(type.getHandleIdentifier());
+        }
+        return teamHandles;
+    }
+    
+    public IRunnableContext getRunnableContext()
+    {
+        return getLaunchConfigurationDialog();
+    }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java
new file mode 100644
index 0000000..45655c6
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java
@@ -0,0 +1,126 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTREBlock.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.debug.ui.SWTFactory;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.DebugMessages;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.OTDebugAdaptorPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * Common addition for all launches, Java App or OSGi.
+ * Adds the "Object Teams Runtime" section.
+ * 
+ * Applied via subclasses (roles).
+ * 
+ * @author stephan
+ * @since 1.2.2
+ */
+@SuppressWarnings("restriction")
+public abstract class OTREBlock 
+{
+	protected String enableCheckboxLabel = DebugMessages.OTLaunching_OTRE_checkbox_label; // overidable default
+	
+	Button _otreToggleButton;
+	boolean _useOTRE;
+	
+	public abstract Button createCheckButton(Composite group, String resourceString);
+	public abstract void setDirty(boolean dirty);
+	public abstract void updateLaunchConfigurationDialog();
+	
+	// create the "Object Teams Runtime" section:
+	public Group createOTRESection(Composite parent, boolean useSWTFactory) {
+		Group group;
+		if (useSWTFactory) {
+			group = SWTFactory.createGroup(parent, DebugMessages.OTLaunching_OTRE_group_title+':', 1, 1, GridData.FILL_HORIZONTAL);
+		} else {
+			group = new Group(parent, SWT.NONE);
+			group.setText(DebugMessages.OTLaunching_OTRE_group_title);
+			GridLayout layout = new GridLayout();
+			layout.numColumns = 1;
+			group.setLayout(layout);
+			group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		}
+		
+        this._otreToggleButton = createCheckButton(group, this.enableCheckboxLabel); 
+        this._otreToggleButton.addSelectionListener(new SelectionAdapter() 
+	        {
+				public void widgetSelected(SelectionEvent e) {
+	                OTREBlock.this._useOTRE = OTREBlock.this._otreToggleButton.getSelection();
+	                setDirty(true);
+	                updateLaunchConfigurationDialog();
+	            }
+	        });
+        
+        return group;
+	}
+	
+	// read values from 'config':
+	public void initializeFrom(ILaunchConfiguration config) {
+        try {
+			tryInitializeFrom(config, hasOTJProject(config));
+        }
+        catch (CoreException ex) {
+            OTDebugAdaptorPlugin.getDefault().getLog().log(
+            		new Status(Status.ERROR, 
+            				   OTDebugAdaptorPlugin.PLUGIN_ID, 
+            				   DebugMessages.OTLaunching_loading_failed_msg,  
+            				   ex));
+        }
+	}
+	protected void tryInitializeFrom(ILaunchConfiguration config, boolean hasOTJProject) throws CoreException {
+		this._otreToggleButton.setEnabled(hasOTJProject);
+		this._useOTRE = config.getAttribute(OTDebugPlugin.OT_LAUNCH, this._useOTRE);
+		this._otreToggleButton.setSelection(this._useOTRE);
+	}
+	
+	boolean hasOTJProject(ILaunchConfiguration config) {
+		try {
+			String projectName = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+			if (projectName != null) {
+				IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+				if (project != null && project.hasNature(JavaCore.OTJ_NATURE_ID))
+					return true;
+			}
+		} catch (CoreException e) {
+			// problems with either config or project, obviously not a sound OT-launch
+		}
+		return false;
+	}
+	
+	// apply the value from the checkbox:
+	public void performApply(ILaunchConfigurationWorkingCopy config) {
+		if (this._otreToggleButton != null)
+			config.setAttribute(OTDebugPlugin.OT_LAUNCH, this._useOTRE);
+    }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java
new file mode 100644
index 0000000..b651668
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java
@@ -0,0 +1,254 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2008 Technical University Berlin, Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: PDELaunchingAdaptor.java 23461 2010-02-04 22:10:39Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.util.Util;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.objectteams.otdt.debug.TeamBreakpointInstaller;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.DebugMessages;
+import org.eclipse.objectteams.otdt.internal.debug.adaptor.OTDebugAdaptorPlugin;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import base org.eclipse.pde.internal.ui.launcher.JREBlock;
+import base org.eclipse.pde.ui.launcher.AbstractLauncherTab;
+import base org.eclipse.pde.launching.AbstractPDELaunchConfiguration;
+import base org.eclipse.pde.launching.JUnitLaunchConfigurationDelegate;
+
+/**
+ * This team adapts all Eclipse and OSGi launches (Launcher) and launch configurations (JREBlock and LauncherTab).
+ * 
+ * @author stephan
+ * @since 1.2.2
+ */
+@SuppressWarnings("restriction")
+public team class PDELaunchingAdaptor {
+	
+	/** Mediating between LauncherTab and JREBlock: */
+	LauncherTab currentTab = null;
+	
+	static final String OSGI_EXTENSIONS       = "-Dosgi.framework.extensions=org.eclipse.objectteams.otequinox.hook"; //$NON-NLS-1$
+	static final String HOOK_CONFIGURATOR     = "-Dosgi.hook.configurators.include=org.eclipse.objectteams.otequinox.hook.HookConfigurator";//$NON-NLS-1$
+	static final String CLASSLOADER_LOCKING   = "-Dosgi.classloader.lock=classname"; //$NON-NLS-1$
+	static final String ENABLE_OTEQUINOX      = "-Dot.equinox=1"; //$NON-NLS-1$     // this also causes the WORKAROUND_REPOSITORY flag being set to true in OTRE.
+	static final String DISABLE_OTEQUINOX     = "-Dot.equinox=false"; //$NON-NLS-1$ // prevents TransformerHook installation and start of TransformerPlugin
+	static final String OT_DEBUG_VMARG        = "-Dot.debug"; //$NON-NLS-1$
+	static final String[] OT_VM_ARGS          = { OSGI_EXTENSIONS, HOOK_CONFIGURATOR, CLASSLOADER_LOCKING, ENABLE_OTEQUINOX };
+	static final String[] OT_VM_DEBUG_ARGS    = { OSGI_EXTENSIONS, HOOK_CONFIGURATOR, CLASSLOADER_LOCKING, ENABLE_OTEQUINOX, OT_DEBUG_VMARG };
+	static final String[] VM_ARGS          = { CLASSLOADER_LOCKING, DISABLE_OTEQUINOX };
+	static final String[] VM_DEBUG_ARGS    = { CLASSLOADER_LOCKING, DISABLE_OTEQUINOX, OT_DEBUG_VMARG };
+
+	/** 
+	 * Extend pre-built vm arguments with OT/Equinox specifics (depending on run/debug mode).
+	 */
+	static String[] extendVMArguments(String[] args, String mode) {
+		String[] otArgs = OT_VM_ARGS;
+		if (mode != null && mode.equals(ILaunchManager.DEBUG_MODE))
+			otArgs = OT_VM_DEBUG_ARGS;
+	
+		if (args == null || args.length == 0)
+			return otArgs;
+	
+		String[] combinedArgs = new String[args.length + otArgs.length];
+		System.arraycopy(args, 0, combinedArgs, 0, args.length);
+		System.arraycopy(otArgs, 0, combinedArgs, args.length, otArgs.length);
+		return combinedArgs;
+	}
+	static String[] addDisableOTEquinoxArgument(String[] args) {
+		String[] combinedArgs = new String[args.length + 1];
+		System.arraycopy(args, 0, combinedArgs, 0, args.length);
+		combinedArgs[args.length] = DISABLE_OTEQUINOX;
+		return combinedArgs;		
+	}
+	/* alternate version for single string signature. */
+	static String extendVMArguments(String args, String mode) {
+		String otArgs;
+		if (mode != null && mode.equals(ILaunchManager.DEBUG_MODE))
+			otArgs = Util.concatWith(OT_VM_DEBUG_ARGS, ' ');
+		else
+			otArgs = Util.concatWith(OT_VM_ARGS, ' ');
+	
+		if (args == null || args.length() == 0)
+			return otArgs;
+		
+		return args+' '+otArgs;
+	}
+
+	/** 
+	 * Installs breakpoints needed for the TeamMonitor into org.objectteams.Team.
+	 * Needs to find a project with OTJavaNature to do this.
+	 */
+	static void installOOTBreakpoints(IProject[] projects) throws CoreException
+	{
+		if (projects != null)
+			for (IProject project : projects) 
+				// find org.objectteams.Team in any OT/J Project:
+				if (project.getNature(JavaCore.OTJ_NATURE_ID) != null) {
+					TeamBreakpointInstaller.installTeamBreakpoints(JavaCore.create(project));
+					return; // good, done.
+				}
+		logException(null, Status.WARNING, DebugMessages.OTLaunching_no_OTJ_project_found);
+	}
+	
+	static void logException(CoreException ex, int level, String msg) {
+		OTDebugPlugin.getDefault().getLog().log(
+						new Status(level, OTDebugAdaptorPlugin.PLUGIN_ID, 0, msg, ex));
+	}
+	
+	// helper needed to protect a guard from exception:
+	static boolean isOTLaunch (ILaunchConfiguration configuration) {
+		try {
+			return configuration.getAttribute(OTDebugPlugin.OT_LAUNCH, false);
+		} catch (CoreException ce) {
+			return false;
+		}
+	}
+	
+	/** Generalizes over normal pde launches and JUnit plugin launches. */
+	abstract protected class AbstractLauncher 
+	{
+		abstract IProject[] getProjectsForProblemSearch(ILaunchConfiguration config, String mode)
+			throws CoreException;
+		
+		String mode;
+		
+		void prepareLaunch(ILaunchConfiguration configuration, String mode) 
+		{
+			this.mode = mode;
+			if (isOTLaunch(configuration) && ILaunchManager.DEBUG_MODE.equals(mode))
+				try {
+					PDELaunchingAdaptor.installOOTBreakpoints(getProjectsForProblemSearch(configuration, mode));
+				} catch (CoreException ex) {
+					logException(ex, Status.WARNING, DebugMessages.OTLaunching_no_OTJ_project_found);
+				}
+		}
+	}
+	
+	/**
+	 * This role adapts any pde-launch where the OT/Equinox flag is set to true:
+	 * <ul>
+	 * <li>add OT-specific arguments to the vm args (extendVMArguments)</li>
+	 * <li>install the breakpoints needed by the TeamMonitor (prepareLaunch)</li>
+	 * </ul>
+	 */
+	protected class Launcher extends AbstractLauncher playedBy AbstractPDELaunchConfiguration 
+	{	
+		@SuppressWarnings("decapsulation")
+		getProjectsForProblemSearch -> getProjectsForProblemSearch;
+		
+		// Extend VM arguments:
+		String[] extendVMArguments(ILaunchConfiguration config) <- replace String[] getVMArguments(ILaunchConfiguration config);
+		callin String[] extendVMArguments(ILaunchConfiguration config) throws CoreException 
+		{
+			String[] args = base.extendVMArguments(config);
+			if (isOTLaunch(config))
+				return PDELaunchingAdaptor.extendVMArguments(args, this.mode);
+			else
+				return PDELaunchingAdaptor.addDisableOTEquinoxArgument(args);
+		}
+			
+		// install breakpoints and record launch mode (run/debug):
+		prepareLaunch <- before launch;
+	}
+	
+	/** Unfortunately JUnit launches are slightly different (and not related by inheritance) */
+	protected class JUnitLauncher extends AbstractLauncher playedBy JUnitLaunchConfigurationDelegate 
+	{
+		@SuppressWarnings("decapsulation")
+		getProjectsForProblemSearch -> getProjectsForProblemSearch;
+		
+		// Extend VM arguments:
+		String extendVMArgument(ILaunchConfiguration config) <- replace String getVMArguments(ILaunchConfiguration config);
+		callin String extendVMArgument(ILaunchConfiguration config) throws CoreException 
+		{
+			String result = base.extendVMArgument(config);
+			if (isOTLaunch(config))
+				return PDELaunchingAdaptor.extendVMArguments(result, this.mode);
+			else
+				return result+' '+DISABLE_OTEQUINOX;
+		}
+			
+		// install breakpoints and record launch mode (run/debug):
+		prepareLaunch <- before launch;		
+	}
+
+	/** 
+	 * UI: This role allows us to insert our "Object Teams Runtime" block just after the JREBlock.
+	 */
+	protected class JREBlock playedBy JREBlock {
+		// build the GUI:
+		void appendOTOption(Composite parent) <- after void createControl(Composite parent)
+			base when (PDELaunchingAdaptor.this.currentTab != null); // only within the LauncherTab#launcherTabCFlow() (see below)
+
+		void appendOTOption(Composite parent) {
+			PDELaunchingAdaptor.this.currentTab.createOTRESection(parent, false/*useSWTFactory*/);
+		}		
+	}
+	
+	/**
+	 * This role manages the UI-part of this team: 
+	 * <ul>
+	 * <li>insert a new group after the JREBlock.</li>
+	 * <li>read (initializeFrom) and apply (performApply) the new flag.</li></ul>
+	 */
+	protected class LauncherTab extends OTREBlock playedBy AbstractLauncherTab {
+
+		LauncherTab(AbstractLauncherTab b) {
+			// different label than default:
+			this.enableCheckboxLabel = DebugMessages.OTLaunching_OTEquinox_checkbox_label;
+		}
+		
+		// callout interface:
+		@SuppressWarnings("decapsulation")
+		Button createCheckButton(Composite parent, String label) -> Button createCheckButton(Composite parent, String label);
+		
+		@SuppressWarnings("decapsulation")
+		void setDirty(boolean dirty) -> void setDirty(boolean dirty);
+
+		void updateLaunchConfigurationDialog() -> void updateLaunchConfigurationDialog();
+		
+		// CFlow to let the JREBlock trigger building the GUI:
+		launcherTabCFlow <- replace createControl;
+		callin void launcherTabCFlow(Composite parent) {
+			try {
+				PDELaunchingAdaptor.this.currentTab = this;
+				base.launcherTabCFlow(parent);
+			} finally {
+				PDELaunchingAdaptor.this.currentTab = null;
+			}
+		}
+		
+		// connect triggers to inherited methods:
+		void initializeFrom(ILaunchConfiguration config) <- after void initializeFrom(ILaunchConfiguration config)
+			when (this._otreToggleButton != null); // i.e.: is this the tab containing the JREBlock?
+
+		@Override
+		boolean hasOTJProject(ILaunchConfiguration config) {
+			return true; // assume we might have an OT project - even without scanning through all projects; always want to enable our options
+		}
+
+		void performApply(ILaunchConfigurationWorkingCopy config) 
+				<- after void performApply(ILaunchConfigurationWorkingCopy config);		
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/TeamConfig.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/TeamConfig.java
new file mode 100644
index 0000000..41b7c95
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/TeamConfig.java
@@ -0,0 +1,453 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2005, 2009 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamConfig.java 23456 2010-02-04 20:44:45Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.debug.adaptor.launching;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.ui.viewsupport.AppearanceAwareLabelProvider;
+import org.eclipse.jdt.ui.JavaElementLabels;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.ui.OTDTUIPlugin;
+import org.eclipse.objectteams.otdt.ui.dialogs.ISearchFilter;
+import org.eclipse.objectteams.otdt.ui.dialogs.TeamSelectionDialog;
+
+/**
+ * Configuration data for the "Team Activation" tab.
+ * 
+ * Created on 02.02.2005
+ * @author gis
+ */
+@SuppressWarnings("restriction")
+public class TeamConfig extends Composite
+{
+
+	private Button _downButton;
+	private Button _upButton;
+	private Button _removeButton;
+	private Button _addButton;
+	private OTLaunchConfigurationTab _otLaunchConfigTab;
+    private TableViewer _teamList;
+    private Button _activeCheckButton;
+    
+    public TeamConfig(Composite parent, int style, OTLaunchConfigurationTab otlcTab)
+    {
+        super(parent, style);
+        _otLaunchConfigTab = otlcTab;
+        
+        GridLayout grid = new GridLayout();
+        grid.numColumns = 1;
+        grid.marginWidth = 3;
+        setLayout(grid);
+        
+        _activeCheckButton = new Button(this, SWT.CHECK);
+        _activeCheckButton.setText(OTDTUIPlugin.getResourceString("TeamConfig.activate_checkbox_description")); //$NON-NLS-1$
+		GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+		_activeCheckButton.setLayoutData(data);
+		_activeCheckButton.setFont(this.getFont());
+		_activeCheckButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+            	boolean active = isActive();	
+            	_teamList.getControl().setEnabled(active);
+            	_otLaunchConfigTab.setModified();
+            }
+            public void widgetDefaultSelected(SelectionEvent e) {
+                widgetSelected(e);
+            }
+        });
+        
+		Composite mainCompo = new Composite(this, SWT.NULL);
+		mainCompo.setLayout(new FormLayout());
+		data = new GridData(GridData.FILL_BOTH);
+		mainCompo.setLayoutData(data);
+		
+        _teamList = new TableViewer(mainCompo, SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL);
+        AppearanceAwareLabelProvider labelProvider = new AppearanceAwareLabelProvider();
+        labelProvider.setTextFlags(JavaElementLabels.T_POST_QUALIFIED);
+        _teamList.setLabelProvider(labelProvider);
+        
+        _teamList.setContentProvider(new IStructuredContentProvider() {
+            @SuppressWarnings("unchecked") // cast to generic list not supported
+			public Object[] getElements(Object inputElement)
+            {
+                if (inputElement instanceof List)
+                {
+                    List<IType> list = (List<IType>) inputElement;
+                    return list.toArray(new IType[list.size()]);
+                }
+                return null;
+            }
+
+            public void dispose() {}
+            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+        });
+        
+        _teamList.addPostSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event)
+            {
+                checkEnablement();
+            }
+        });
+        
+        final FormData formData = new FormData();
+        formData.right = new FormAttachment(100, -162);
+        formData.bottom = new FormAttachment(100, -5);
+        formData.top = new FormAttachment(0, 5);
+        formData.left = new FormAttachment(0, 2);
+        Control teamListControl = _teamList.getControl();
+        teamListControl.setLayoutData(formData);
+
+        final Composite composite_1 = new Composite(mainCompo, SWT.NONE);
+        final GridLayout gridLayout = new GridLayout();
+        gridLayout.horizontalSpacing = 0;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+        composite_1.setLayout(gridLayout);
+        final FormData formData_1 = new FormData();
+        formData_1.left = new FormAttachment(teamListControl, 5, SWT.RIGHT);
+        formData_1.bottom = new FormAttachment(teamListControl, 0, SWT.BOTTOM);
+        formData_1.right = new FormAttachment(100, -5);
+        formData_1.top = new FormAttachment(teamListControl, 0, SWT.TOP);
+        composite_1.setLayoutData(formData_1);
+        _addButton = new Button(composite_1, SWT.NONE);
+        final GridData gridData = new GridData(GridData.FILL_HORIZONTAL| GridData.VERTICAL_ALIGN_BEGINNING);
+        _addButton.setLayoutData(gridData);
+        _addButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+               	askAddTeam();
+            }
+			public void widgetDefaultSelected(SelectionEvent e) {
+			    widgetSelected(e);
+            }
+        });
+        _addButton.setText(OTDTUIPlugin.getResourceString("TeamConfig.add_team_button_label")); //$NON-NLS-1$
+
+        _removeButton = new Button(composite_1, SWT.NONE);
+        final GridData gridData_1 = new GridData(GridData.FILL_HORIZONTAL| GridData.VERTICAL_ALIGN_BEGINNING);
+        _removeButton.setLayoutData(gridData_1);
+        _removeButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+            	removeSelected();
+            }
+            public void widgetDefaultSelected(SelectionEvent e) {
+                widgetSelected(e);
+            }
+        });
+        _removeButton.setText(OTDTUIPlugin.getResourceString("TeamConfig.remove_team_button_label")); //$NON-NLS-1$
+        
+        _upButton = new Button(composite_1, SWT.NONE);
+        final GridData gridData_2 = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+        gridData_2.horizontalSpan = 2;
+        _upButton.setLayoutData(gridData_2);
+        _upButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+            	moveSelectedUp();
+            }
+            public void widgetDefaultSelected(SelectionEvent e) {
+                widgetSelected(e);
+            }
+        });
+        _upButton.setText(OTDTUIPlugin.getResourceString("TeamConfig.team_up_button_label")); //$NON-NLS-1$
+        
+        _downButton = new Button(composite_1, SWT.NONE);
+        final GridData gridData_3 = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+        _downButton.setLayoutData(gridData_3);
+        _downButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+            	moveSelectedDown();
+            }
+            public void widgetDefaultSelected(SelectionEvent e) {
+                widgetSelected(e);
+            }
+        });
+        _downButton.setText(OTDTUIPlugin.getResourceString("TeamConfig.team_down_button_label")); //$NON-NLS-1$
+        
+    }
+
+    public void dispose()
+    {
+        super.dispose();
+    }
+
+    protected void checkSubclass()
+    {
+        super.checkSubclass();
+    }
+    
+//	private class WidgetListener implements ModifyListener {
+//		public void modifyText(ModifyEvent e) {
+//			_otLaunchConfigTab.setModified();
+//		}
+//		public void widgetDefaultSelected(SelectionEvent e) {
+//		}
+//	}
+//	private WidgetListener fListener = new WidgetListener();
+	
+    
+    private void addTeam(IType chosenTeam) 
+    {
+    	if (chosenTeam != null) 
+    	{
+    	    IType teamType = chosenTeam;
+    	    if (!(chosenTeam instanceof IOTType))
+    	        teamType = OTModelManager.getOTElement(chosenTeam);
+    	    
+    	    if (teamType != null)
+    	    {
+    	        // TODO (carp): perform further checks (e.g. must have public default constructor)
+				_otLaunchConfigTab.getTeamModel().add(teamType);
+            	_otLaunchConfigTab.setModified();
+		        checkEnablement();
+		        _teamList.refresh();
+    	    }
+    	    else
+    	    {
+    	        MessageDialog.openError(
+    	                getShell(), 
+    	                OTDTUIPlugin.getResourceString("TeamConfig.error_adding_team_title"),  //$NON-NLS-1$
+    	                MessageFormat.format(
+    	                        OTDTUIPlugin.getResourceString("TeamConfig.error_adding_team_message"), new Object[] { chosenTeam.getFullyQualifiedName() })); //$NON-NLS-1$
+    	    }
+    	}
+    }
+    
+    public void clearTeamList() {
+        _otLaunchConfigTab.getTeamModel().clear();
+    	checkEnablement();
+        _teamList.refresh();
+    }
+
+    public boolean isActive() {
+    	return _activeCheckButton.getSelection();
+    }
+    
+    public void setActive(boolean active) {
+    	_activeCheckButton.setSelection(active);
+    	_teamList.getControl().setEnabled(active);
+    }
+
+    private IType chooseTeamFromClasspath(IProject project) {
+    	if (project == null || !project.exists())
+    		return null;
+    	
+    	IJavaProject java_project = JavaCore.create(project);
+    	IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[]{ java_project});
+
+    	TeamSelectionDialog dialog = new TeamSelectionDialog(
+    	        TeamConfig.this.getShell(), 
+    	        _otLaunchConfigTab.getRunnableContext(), 
+    	        scope);
+
+		dialog.setTitle(OTDTUIPlugin.getResourceString("TeamConfig.choose_team_dialog_title")); //$NON-NLS-1$
+		dialog.setMessage(OTDTUIPlugin.getResourceString("TeamConfig.choose_team_dialog_description")); //$NON-NLS-1$
+		dialog.setFilter("*"); //$NON-NLS-1$
+		dialog.addSearchFilter(new ISearchFilter() {
+            public IOTType[] filterTypes(IOTType[] types)
+            {
+                List teamModel = _otLaunchConfigTab.getTeamModel();
+                List<IOTType> result = new ArrayList<IOTType>(types.length);
+                for (int i = 0; i < types.length; i++)
+                {
+                    IOTType type = types[i];
+                    // hide abstract teams and those already in the list
+                    if (!Flags.isAbstract(type.getFlags()) && !teamModel.contains(type))
+                        result.add(type);
+                }
+                
+                return result.toArray(new IOTType[result.size()]);
+            }
+        });
+
+	
+		if (dialog.open() == Window.OK) {
+			IType selectedType = (IType) dialog.getFirstResult();
+			return selectedType;
+		}
+    		
+		return null;
+	}
+
+    private void removeSelected()
+    {
+        IStructuredSelection selection = (IStructuredSelection)_teamList.getSelection();
+        for (Iterator iterator = selection.iterator(); iterator.hasNext();)
+        {
+            IType selectedType = (IType) iterator.next();
+            _otLaunchConfigTab.getTeamModel().remove(selectedType);
+        }
+        _otLaunchConfigTab.setModified();
+        checkEnablement();
+        _teamList.refresh();
+    }
+
+    private void askAddTeam()
+    {
+       	IProject project = _otLaunchConfigTab.getProject();
+    	if (project == null)
+    	{
+    	    MessageDialog.openInformation(getShell(), OTDTUIPlugin.getResourceString("TeamConfig.project_not_set_title"), OTDTUIPlugin.getResourceString("TeamConfig.project_not_set_message")); //$NON-NLS-1$ //$NON-NLS-2$
+    	    return;
+    	}
+
+    	// TODO: check if the selected team has a default constructor, otherwise give an error message.
+        IType chosenTeam = chooseTeamFromClasspath(project);
+        if (chosenTeam != null)
+        {
+            addTeam(chosenTeam);
+        }
+    }
+
+    private void moveSelectedUp()
+    {
+        List<IType> teamModel = _otLaunchConfigTab.getTeamModel();
+        
+        final int currentIndex = getTeamSelectionIndex();
+        if (currentIndex > 0) {
+        	IType currentTeam = teamModel.get(currentIndex);
+        	IType aboveTeam = teamModel.get(currentIndex - 1);
+        	teamModel.set(currentIndex - 1, currentTeam);
+        	teamModel.set(currentIndex, aboveTeam);
+        	_teamList.refresh();
+        	_otLaunchConfigTab.setModified();
+        	
+        	checkMoveEnablement();
+        }
+    }
+
+    private void moveSelectedDown()
+    {
+        List<IType> teamModel = _otLaunchConfigTab.getTeamModel();
+        
+        final int currentIndex = getTeamSelectionIndex();
+        if (currentIndex < _otLaunchConfigTab.getTeamModel().size() - 1) {
+        	IType currentTeam = teamModel.get(currentIndex);
+        	IType belowTeam = teamModel.get(currentIndex + 1);
+        	teamModel.set(currentIndex + 1, currentTeam);
+        	teamModel.set(currentIndex, belowTeam);
+        	_teamList.refresh();
+        	_otLaunchConfigTab.setModified();
+        	
+        	checkMoveEnablement();
+        }
+    }
+
+    
+    void checkEnablement()
+    {
+        checkMoveEnablement();
+        checkActiveEnablement();
+        
+        if (_teamList.getSelection().isEmpty())
+    	{
+    	    _removeButton.setEnabled(false);
+    	}
+        else
+        {
+    	    _removeButton.setEnabled(true);
+        }
+    }
+
+    private void checkActiveEnablement()
+    {
+        boolean enable = !_otLaunchConfigTab.getTeamModel().isEmpty();
+        _activeCheckButton.setEnabled(enable);
+    }
+    
+    private void checkMoveEnablement()
+    {
+        final int index = getTeamSelectionIndex();
+
+        if (index == -1)
+    	{
+    	    _upButton.setEnabled(false);
+    	    _downButton.setEnabled(false);
+    	    return;
+    	}
+        
+        final int count = _otLaunchConfigTab.getTeamModel().size();
+        boolean canMove = count >= 2;
+
+        if (index == 0)
+        {
+    	    _upButton.setEnabled(false);
+    	    _downButton.setEnabled(canMove);
+    	}
+        else if (index == count - 1)
+        {
+    	    _downButton.setEnabled(false);
+    	    _upButton.setEnabled(canMove);
+        }
+        else
+        {
+		    _upButton.setEnabled(canMove);
+		    _downButton.setEnabled(canMove);
+        }
+    }
+
+    private int getTeamIndex(Object element)
+    {
+        return _otLaunchConfigTab.getTeamModel().indexOf(element);
+    }
+    
+    private int getTeamSelectionIndex()
+    {
+        IStructuredSelection selection = (IStructuredSelection) _teamList.getSelection();
+        if (selection == null || selection.isEmpty())
+            return -1;
+        
+        return getTeamIndex(selection.getFirstElement());
+    }
+
+    public void setTeamInput(List teamModel)
+    {
+        _teamList.setInput(teamModel);
+    }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/.classpath b/plugins/org.eclipse.objectteams.otdt.debug.ui/.classpath
new file mode 100644
index 0000000..304e861
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/.cvsignore b/plugins/org.eclipse.objectteams.otdt.debug.ui/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/.project b/plugins/org.eclipse.objectteams.otdt.debug.ui/.project
new file mode 100644
index 0000000..cc74313
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.objectteams.otdt.debug.ui</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.objectteams.otdt.debug.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99679bd
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Tue Oct 17 14:45:23 CEST 2006

+eclipse.preferences.version=1

+encoding//src/org/objectteams/otdt/debug/ui/views/TeamViewMessages.properties=8859_1

diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otdt.debug.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..e10b5f1
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,57 @@
+#Tue Sep 18 18:19:58 CEST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ab56ecd
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTDebugUI Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.debug.ui;singleton:=true
+Bundle-Version: 1.3.2.qualifier
+Bundle-Activator: org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin
+Bundle-Vendor: Fraunhofer FIRST
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.jdt.core,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui,
+ org.eclipse.jdt.debug,
+ org.eclipse.jdt.debug.ui,
+ org.eclipse.objectteams.otdt.debug,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.jface.text,
+ org.eclipse.ui.editors,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.jdt.ui,
+ org.eclipse.jdt.launching,
+ org.eclipse.objectteams.otdt.ui
+Export-Package: org.eclipse.objectteams.otdt.debug.ui,
+ org.eclipse.objectteams.otdt.debug.ui.internal,
+ org.eclipse.objectteams.otdt.debug.ui.internal.actions,
+ org.eclipse.objectteams.otdt.debug.ui.internal.preferences,
+ org.eclipse.objectteams.otdt.debug.ui.views
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/build.properties b/plugins/org.eclipse.objectteams.otdt.debug.ui/build.properties
new file mode 100644
index 0000000..feed1da
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               icons/
+src.includes = src/,\
+               .classpath,\
+               .project,\
+               build.properties
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/refresh.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/refresh.gif
new file mode 100644
index 0000000..6f13b0a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/refresh.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sample.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sample.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activation.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activation.gif
new file mode 100644
index 0000000..0e8daad
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activation.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activationtime.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activationtime.gif
new file mode 100644
index 0000000..3d7a794
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activationtime.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_instantiation.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_instantiation.gif
new file mode 100644
index 0000000..db4062c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_instantiation.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_name.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_name.gif
new file mode 100644
index 0000000..907d34f
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_name.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_act.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_act.gif
new file mode 100644
index 0000000..58a8638
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_act.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_act_implicit.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_act_implicit.gif
new file mode 100644
index 0000000..41dc6c2
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_act_implicit.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_inact.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_inact.gif
new file mode 100644
index 0000000..2b5ea0d
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/team_inact.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/tm.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/tm.gif
new file mode 100644
index 0000000..67fd7cc
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/tm.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/plugin.xml b/plugins/org.eclipse.objectteams.otdt.debug.ui/plugin.xml
new file mode 100644
index 0000000..3b15ac9
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/plugin.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.views">
+      <view
+            class="org.eclipse.objectteams.otdt.debug.ui.views.TeamView"
+            icon="icons/tm.gif"
+            name="Team Monitor"
+            category="org.eclipse.objectteams.otdt.ui"
+            id="org.eclipse.objectteams.otdt.debug.ui.views.team">
+         <description>
+            Debug view showing all team instances.
+Supports drill in and interactive (de)activation of teams.
+         </description>
+      </view>
+   </extension>
+   
+
+   <extension
+         point="org.eclipse.ui.perspectiveExtensions">
+      <perspectiveExtension
+            targetID="org.eclipse.objectteams.otdt.ui.OTJavaPerspective">
+         <actionSet
+               id="org.eclipse.debug.ui.breakpointActionSet">
+         </actionSet>
+         <actionSet
+               id="org.eclipse.jdt.debug.ui.JDTDebugActionSet">
+         </actionSet>
+         <viewShortcut
+               id="org.eclipse.objectteams.otdt.debug.ui.views.team">
+         </viewShortcut>
+      </perspectiveExtension>
+      <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
+         <viewShortcut id="org.eclipse.objectteams.otdt.debug.ui.views.team"/>
+      </perspectiveExtension>
+   </extension>
+   
+   
+   <extension
+         point="org.eclipse.ui.preferencePages">
+         
+         <!-- General Object Teams configuration options -->
+         <page
+               id="org.eclipse.objectteams.otdt.debug.ui.preferences.PreferencePage"
+               name="Debug"
+               class="org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferencePage"
+               category="org.eclipse.objectteams.otdt.ui.preferences.GeneralPreferencePage">
+         </page>
+         
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences">
+      </initializer>
+   </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java
new file mode 100644
index 0000000..a04871e
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java
@@ -0,0 +1,86 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugImages.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * @author ike
+ *
+ * $Id: OTDebugImages.java 23432 2010-02-03 23:13:42Z stephan $
+ */
+
+@SuppressWarnings("nls")
+public class OTDebugImages
+{
+    public static final String TEAM_ACTIVATED           = "icons/team_act.gif";
+    public static final String TEAM_IMPLICIT_ACTIVATED  = "icons/team_act_implicit.gif";
+    public static final String TEAM_INACTIVATED         = "icons/team_inact.gif";
+    public static final String SORT_TEAMS_BY_ACTIVATION_TIME = "icons/sort_by_activationtime.gif";
+    public static final String SORT_TEAMS_BY_ACTIVATION_ORDER = "icons/sort_by_activation.gif";
+    public static final String SORT_TEAMS_BY_NAME = "icons/sort_by_name.gif";
+    public static final String SORT_TEAMS_BY_INSTANTIATION = "icons/sort_by_instantiation.gif";
+    public static final String UPDATE_TEAM_VIEW_ACTION = "icons/refresh.gif";
+
+    
+    public static void register()
+    {
+        checkBundleState();
+
+        OTDebugUIPlugin plugin = OTDebugUIPlugin.getDefault();
+        Bundle bundle = plugin.getBundle();
+        ImageRegistry registry = plugin.getImageRegistry();
+
+        register(TEAM_ACTIVATED, bundle, registry);
+        register(TEAM_IMPLICIT_ACTIVATED, bundle, registry);
+        register(TEAM_INACTIVATED, bundle, registry);
+        register(SORT_TEAMS_BY_ACTIVATION_TIME, bundle, registry);
+        register(SORT_TEAMS_BY_ACTIVATION_ORDER, bundle, registry);
+        register(SORT_TEAMS_BY_NAME, bundle, registry);
+        register(SORT_TEAMS_BY_INSTANTIATION, bundle, registry);
+        register(UPDATE_TEAM_VIEW_ACTION, bundle, registry);
+    }
+    
+    public static ImageDescriptor get(String image)
+    {
+        checkBundleState();
+        return OTDebugUIPlugin.getDefault().getImageRegistry().getDescriptor(image);
+    }
+    
+    static void register(String icon, Bundle bundle, ImageRegistry registry)
+    {
+        URL imageURL = bundle.getEntry(icon);
+        ImageDescriptor desc = ImageDescriptor.createFromURL(imageURL);
+        registry.put(icon, desc);
+    }    
+
+    private static void checkBundleState()
+    {
+        if (OTDebugUIPlugin.getDefault().getBundle().getState() != Bundle.ACTIVE)
+            throw new IllegalStateException("Bundle not active: " + OTDebugUIPlugin.getDefault().getBundle().getBundleId());
+    }
+    
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugUIPlugin.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugUIPlugin.java
new file mode 100644
index 0000000..83fad25
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugUIPlugin.java
@@ -0,0 +1,157 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugUIPlugin.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.internal.ui.ColorManager;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.objectteams.otdt.core.exceptions.ExceptionHandler;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.TeamInstance;
+import org.eclipse.objectteams.otdt.debug.ui.internal.CopyInheritanceBreakpointManager;
+import org.eclipse.objectteams.otdt.debug.ui.internal.OTDebugElementAdapterFactory;
+import org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class OTDebugUIPlugin extends AbstractUIPlugin 
+{
+	// preference constants
+	public static final String PLUGIN_ID = "org.eclipse.objectteams.otdt.debug.ui"; //$NON-NLS-1$
+	public static final String TEAM_DETAIL_PANE_ORIENTATION = "ot.teamview.detail.orientation"; //$NON-NLS-1$
+
+    // this id is also used in plugin.xml:
+    public static final String TEAM_VIEW_ID = "org.eclipse.objectteams.otdt.debug.ui.views.team"; //$NON-NLS-1$
+
+    
+	private static final String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
+	public static final String HELP_TEAM_VIEW = PREFIX + "team_view_context"; //$NON-NLS-1$
+
+	//The shared instance.
+	private static OTDebugUIPlugin plugin;
+	//Resource bundle.
+	private ResourceBundle resourceBundle;
+    private CopyInheritanceBreakpointManager _copyInheritanceBPManager;
+
+	// TODO: use JDIDebugUIPlugin to contribute to the UI
+	
+	/**
+	 * The constructor.
+	 */
+	public OTDebugUIPlugin() 
+	{
+		super();
+		plugin = this;
+		try {
+			resourceBundle = ResourceBundle.getBundle("org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPluginResources"); //$NON-NLS-1$
+		} catch (MissingResourceException x) {
+			resourceBundle = null;
+		}
+	}
+
+	/**
+	 * This method is called upon plug-in activation
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		OTDebugPreferences.propagateFilterFlag(getPreferenceStore());
+		
+		// this breakpoint manager listens to two kinds of changes:
+		_copyInheritanceBPManager = new CopyInheritanceBreakpointManager();
+		JDIDebugModel.addJavaBreakpointListener(_copyInheritanceBPManager);
+		ResourcesPlugin.getWorkspace().addResourceChangeListener(_copyInheritanceBPManager, IResourceChangeEvent.POST_CHANGE);
+		
+		IAdapterManager manager= Platform.getAdapterManager();
+		OTDebugElementAdapterFactory propertiesFactory = new OTDebugElementAdapterFactory();
+		manager.registerAdapters(propertiesFactory, OTDebugElementsContainer.class);
+		manager.registerAdapters(propertiesFactory, TeamInstance.class);
+		
+	}
+
+	/**
+	 * This method is called when the plug-in is stopped
+	 */
+	public void stop(BundleContext context) throws Exception {
+	    JDIDebugModel.removeJavaBreakpointListener(_copyInheritanceBPManager);
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance.
+	 */
+	public static OTDebugUIPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns the string from the plugin's resource bundle,
+	 * or 'key' if not found.
+	 */
+	public static String getResourceString(String key) {
+		ResourceBundle bundle = OTDebugUIPlugin.getDefault().getResourceBundle();
+		try {
+			return (bundle != null) ? bundle.getString(key) : key;
+		} catch (MissingResourceException e) {
+			return key;
+		}
+	}
+
+	/**
+	 * Returns the plugin's resource bundle,
+	 */
+	public ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+	
+	/**
+	 * Returns the a color based on the type of output.
+	 * Valid types:
+	 * <li>OT_GENERATED_CODE_COLOR</li>
+	 * <li>CONSOLE_SYS_ERR_RGB</li>
+	 */
+	public static Color getPreferenceColor(String type) {
+		return ColorManager.getDefault().getColor(PreferenceConverter.getColor(getDefault().getPreferenceStore(), type));
+	}
+
+	
+	public static ExceptionHandler getExceptionHandler()
+	{
+		return new ExceptionHandler(PLUGIN_ID);
+	}
+    
+    protected void initializeImageRegistry(ImageRegistry reg)
+    {
+        super.initializeImageRegistry(reg);
+        OTDebugImages.register();
+    }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/BreakpointMessages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/BreakpointMessages.java
new file mode 100644
index 0000000..864cb2e
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/BreakpointMessages.java
@@ -0,0 +1,36 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: BreakpointMessages.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class BreakpointMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.debug.ui.internal.BreakpointMessages"; //$NON-NLS-1$
+	public static String CopyInheritanceBreakpointManager_find_tsub_types_task;
+	public static String CopyInheritanceBreakpointManager_toggle_enablement_job;
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, BreakpointMessages.class);
+	}
+
+	private BreakpointMessages() {
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/BreakpointMessages.properties b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/BreakpointMessages.properties
new file mode 100644
index 0000000..976c95f
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/BreakpointMessages.properties
@@ -0,0 +1,2 @@
+CopyInheritanceBreakpointManager_find_tsub_types_task=Finding tsub-types...
+CopyInheritanceBreakpointManager_toggle_enablement_job=Toggle copied breakpoint enablement
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/CopyInheritanceBreakpointManager.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/CopyInheritanceBreakpointManager.java
new file mode 100644
index 0000000..fbcebcf
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/CopyInheritanceBreakpointManager.java
@@ -0,0 +1,426 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: CopyInheritanceBreakpointManager.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.Message;
+import org.eclipse.jdt.debug.core.IJavaBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaBreakpointListener;
+import org.eclipse.jdt.debug.core.IJavaDebugTarget;
+import org.eclipse.jdt.debug.core.IJavaInterfaceType;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.IOTTypeHierarchy;
+import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.core.compiler.ISMAPConstants;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+
+/**
+ * This class deals with the problem that a breakpoint in role-method won't have an effect
+ * in tsub-classes. This is due to the fact, that methods are inherited through CopyInheritance,
+ * that is, their byte-code is copied to the tsub-class.
+ * 
+ * This class sort of performs copy-inheritance for breakpoints. I.e. whenever a breakpoint
+ * is installed for a role-method, it will be installed in the copied methods of all tsub-classes
+ * as well.
+ * 
+ * When uninstalling a breakpoint for a target, the copies are removed from that target, 
+ * and completely removed if no longer installed in any targets.
+ * 
+ * Mapping of line numbers is handled by a JavaStratumLineBreakpoint for stratum "OTJ".
+ * 
+ * @author gis, stephan
+ */
+public class CopyInheritanceBreakpointManager implements IJavaBreakpointListener, IResourceChangeListener
+{
+    private static final Object OT_BREAKPOINT_COPY = "OT_BREAKPOINT_COPY"; //$NON-NLS-1$
+    
+    private static final String ROLE_CLASS_SEPARATOR = "$__OT__"; //$NON-NLS-1$
+    
+    /** keep our own mapping from original breakpoints to copies (the breakpoint manager only knows installed breakpoints). */
+    private Map<IMarker, List<IJavaBreakpoint>> copiedBreakpoints = new HashMap<IMarker, List<IJavaBreakpoint>>();
+
+    public CopyInheritanceBreakpointManager()
+    {
+        super();
+    }
+
+    public void addingBreakpoint(IJavaDebugTarget target, IJavaBreakpoint breakpoint) {}
+    public void breakpointInstalled(IJavaDebugTarget target, IJavaBreakpoint breakpoint) {}
+    public void breakpointHasRuntimeException(IJavaLineBreakpoint breakpoint, DebugException exception) {}
+    public void breakpointHasCompilationErrors(IJavaLineBreakpoint breakpoint, Message[] errors) {}
+    public int breakpointHit(IJavaThread thread, IJavaBreakpoint breakpoint)
+    {
+        return IJavaBreakpointListener.DONT_CARE;
+    }
+    
+    /**
+     * The debugger signals that a breakpoint is being installed into the VM.
+     * Check if we need to add copies into tsub roles.
+     */
+    public int installingBreakpoint(IJavaDebugTarget target, IJavaBreakpoint breakpoint, IJavaType type)
+    {
+        try {
+        	if (isBreakpointCopy(breakpoint))
+        		return IJavaBreakpointListener.INSTALL; // yes please! (no further copying needed)
+        	
+        	if (!(type instanceof IJavaInterfaceType)) 
+        		return IJavaBreakpointListener.DONT_CARE; // only use ifc part, (tsuper-) class may not be loaded
+
+	        if (breakpoint instanceof IJavaLineBreakpoint)
+                addTSubBreakpointsFor(type, (IJavaLineBreakpoint) breakpoint, target);
+        }
+        catch (CoreException ex)
+        {
+            OTDebugUIPlugin.getExceptionHandler().logCoreException("Problem with breakpoint handling", ex); //$NON-NLS-1$
+        }
+        
+        return IJavaBreakpointListener.DONT_CARE;
+    }
+
+    private boolean isBreakpointCopy(IJavaBreakpoint breakpoint) throws CoreException
+    {
+        IMarker marker = breakpoint.getMarker();
+        if (marker == null)
+            return false;
+        
+        Map properties = marker.getAttributes();
+        return properties.containsKey(OT_BREAKPOINT_COPY);
+    }
+
+    private void addTSubBreakpointsFor(IJavaType triggerType, IJavaLineBreakpoint breakpoint, IJavaDebugTarget target) 
+    		throws CoreException
+    {
+    	IMarker marker = breakpoint.getMarker();
+        IType type = BreakpointUtils.getType(breakpoint);
+
+        // only act when triggered by the class of the breakpoint (which must be a role):
+        IOTType otType = OTModelManager.getOTElement(type);
+        if (otType == null)
+        	return;
+        if (!otType.getFullyQualifiedName('$').equals(triggerType.getName()))
+        	return;
+        
+    	// check whether copies have already been created:
+    	List<IJavaBreakpoint> existingCopies = this.copiedBreakpoints.get(marker);
+    	if (existingCopies != null) {
+    		// tsub breakpoints are already created, only add them to this target:
+    		for (IJavaBreakpoint existingCopy : existingCopies)
+    			target.breakpointAdded(existingCopy);
+    		return;
+    	}
+    	
+    	// find tsub roles to install into:
+        IType[] tsubClasses = new TSubClassComputer((IRoleType) otType).getSubClasses();
+        if (tsubClasses == null || tsubClasses.length == 0)
+            return;
+
+        // perform:
+        String fileName = type.getCompilationUnit().getElementName();
+        List<IJavaBreakpoint> newBreakpoints = new ArrayList<IJavaBreakpoint>(tsubClasses.length);
+        for (IType tsubClass : tsubClasses) {
+			IJavaLineBreakpoint newBreakpoint = propagateBreakpoint(breakpoint, fileName, tsubClass, target);
+			if (newBreakpoint != null)
+				newBreakpoints.add(newBreakpoint);
+		}
+
+		this.copiedBreakpoints.put(marker, newBreakpoints);
+
+    }
+
+    /**
+     * Propagate the given breakpoint to one tsub role.
+     * 
+     * @param breakpoint  breakpoint to copy
+     * @param fileName    name of the source file that implements the given line
+     * @param destType	  the tsub role into which to install
+     * @param target	  the debug target into which the breakpoint should be installed
+     * @return a new breakpoint or null
+     * @throws CoreException when accessing the existing breakpoint fails or the marker for the new breakpoint could not be created
+     */
+    private IJavaLineBreakpoint propagateBreakpoint(IJavaLineBreakpoint breakpoint, String fileName, IType destType, IJavaDebugTarget target)
+    		throws CoreException
+    {
+        if (destType == null)
+        {
+            OTDebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,
+            									OTDebugUIPlugin.PLUGIN_ID,
+            									"CopyInheritanceBreakpointManager.propagateBreakpoint(): tsub type is null")); //$NON-NLS-1$
+            return null;
+        }
+
+        Exception ex = null;
+        int sourceLineNumber = -1;
+        try {
+	        sourceLineNumber = breakpoint.getLineNumber();
+        } catch (CoreException ce) {
+        	ex = ce;
+        }
+        if (sourceLineNumber == -1 || ex != null)
+        {
+        	OTDebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,
+							        			OTDebugUIPlugin.PLUGIN_ID,
+							        			"CopyInheritanceBreakpointManager.propagateBreakpoint(): source line number not found", //$NON-NLS-1$
+							        			ex));
+        	return null;
+        }
+        
+        return duplicateBreakpoint(breakpoint, fileName, destType, sourceLineNumber, target);
+    }
+
+    /**
+     * Duplicate the given breakpoint for the given tsub-role.
+     * 
+     * @param breakpoint	 	breakpoint to copy
+     * @param fileName 		  	name of the source file that implements the given line
+     * @param destType 		  	the tsub role into which to install
+     * @param sourceLineNumber	line number within fileName
+     * @param target		 	the debug target into which the breakpoint should be installed
+     * @return a new breakpoint, never null;
+     * @throws CoreException when accessing the existing breakpoint fails or the marker for the new breakpoint could not be created
+     */
+    private IJavaLineBreakpoint duplicateBreakpoint(IJavaLineBreakpoint breakpoint, String fileName, IType destType, int sourceLineNumber, IJavaDebugTarget target) 
+    		throws CoreException
+    {
+        // FIXME: other breakpoint types, exception, properties (null)
+        Map properties = getBreakpointProperties(breakpoint);
+        Boolean origEnabled = (Boolean) properties.get(IBreakpoint.ENABLED);
+        String destName = getClassPartName(destType);
+        // Note: by marking the breakpoint as unregistered, we prevent it from showing up in the breakpoints view.
+        // Conversely this means that we can not rely on the breakpoint manager but must maintain our own registry (copiedBreakpoints)
+		IJavaLineBreakpoint newBreakpoint = JDIDebugModel.createStratumBreakpoint(
+															breakpoint.getMarker().getResource(),
+															ISMAPConstants.OTJ_STRATUM_NAME,
+															fileName,
+															null, //sourcePath,
+															destName, // classNamePattern
+															sourceLineNumber,
+															-1, -1, // charStart, charEnd
+															breakpoint.getHitCount(),
+															false,
+															properties);
+		// restore one attribute that is hardcoded in JavaStratumLineBreakpoint.<init>:
+		if (!origEnabled)
+			try {
+				newBreakpoint.getMarker().setAttribute(IBreakpoint.ENABLED, Boolean.FALSE);
+			} catch (CoreException ex) {
+				OTDebugUIPlugin.getExceptionHandler().logCoreException("Unable to disable breakpoint", ex); //$NON-NLS-1$
+			}
+        target.getDebugTarget().breakpointAdded(newBreakpoint);
+        
+        return newBreakpoint;
+    }
+    
+    /**
+ 	 * If type is a role return the name of its class-part,
+     * and ensure all enclosing role-teams are given by their class-part, too.
+     */
+    String getClassPartName(IType type) {
+    	IType enclosing = type.getDeclaringType();
+    	try {
+			if (   enclosing != null 
+				&& Flags.isTeam(enclosing.getFlags()))
+				return getClassPartName(enclosing)+ROLE_CLASS_SEPARATOR+type.getElementName();
+		} catch (JavaModelException e) {
+			// fall through
+		}
+		return type.getFullyQualifiedName();
+    }
+
+    /** Initialize breakpoint properties from `breakpoint' and add a few values specific to copies. */
+    private Map getBreakpointProperties(IJavaLineBreakpoint breakpoint)
+    {
+        Map properties = new HashMap(13);
+        try {
+			properties.putAll(breakpoint.getMarker().getAttributes());
+		} catch (CoreException e) {
+			// couldn't read marker attributes
+		}
+		properties.put(IBreakpoint.PERSISTED, Boolean.FALSE);
+        properties.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); // hide from the ruler
+        properties.put(OT_BREAKPOINT_COPY, Boolean.TRUE);
+        
+        return properties;
+    }
+
+    /**
+     * A breakpoint has been removed from a target. Do the same for copies of this breakpoint.
+     * 
+     * @param target	 the debug target from which the breakpoint has been removed
+     * @param breakpoint the breakpoint (potential tsuper). 
+     */
+    public void breakpointRemoved(IJavaDebugTarget target, IJavaBreakpoint breakpoint) 
+    {
+        IMarker marker = breakpoint.getMarker();
+        if (marker == null || !marker.exists())
+            return;
+
+      	// retrieve breakpoint and disable it:
+    	List<IJavaBreakpoint> copies = this.copiedBreakpoints.get(marker);
+    	if (copies == null) 
+    		return;
+    	
+    	List<IJavaBreakpoint> remainingCopies = new ArrayList<IJavaBreakpoint>(copies.size());
+		for (IJavaBreakpoint copy : copies)  {
+			target.getDebugTarget().breakpointRemoved(copy, null);
+			try {
+				if (copy.isInstalled())
+					remainingCopies.add(copy);
+				else
+					copy.delete();
+			} catch (CoreException ex) {
+				OTDebugUIPlugin.getExceptionHandler().logCoreException("Unable to query copied breakpoint", ex); //$NON-NLS-1$
+			}
+        }
+		// cleanup if no more copies are active:
+		if (remainingCopies.size() == 0)
+			this.copiedBreakpoints.remove(marker);
+		// cleanup if fewer copies are active:
+		else if (remainingCopies.size() != copies.size())
+			this.copiedBreakpoints.put(marker, remainingCopies);
+    }
+
+    private class TSubClassComputer implements IRunnableWithProgress
+    {
+        private IOTTypeHierarchy _hierarchy;
+        private IRoleType _roleType;
+        private IType[] _subClasses;
+        
+        public TSubClassComputer(IRoleType otType)
+        {
+            _roleType = otType;
+        }
+        
+        public void run(IProgressMonitor monitor)
+        	throws InvocationTargetException, InterruptedException
+		{
+		    monitor.beginTask(BreakpointMessages.CopyInheritanceBreakpointManager_find_tsub_types_task, 1);
+		    IProgressMonitor mon = new SubProgressMonitor(monitor, 1);
+		    try
+		    {
+		        _hierarchy = _roleType.newOTTypeHierarchy(mon);
+		        _hierarchy.setPhantomMode(true);
+		        _subClasses = _hierarchy.getAllTSubtypes((IType)_roleType);
+
+		    }
+		    catch (JavaModelException ex)
+		    {
+		        throw new InvocationTargetException(ex);
+		    }
+		    finally
+		    {
+		        mon.done();
+		    }
+		}
+
+        /**
+         * @return null or the computed tsub classes
+         */
+        public IType[] getSubClasses()
+        {
+            try 
+            {
+//                PlatformUI.getWorkbench().getProgressService().busyCursorWhile(this);
+                run(new NullProgressMonitor());
+            }
+            catch (InvocationTargetException ex)
+            {
+                if (ex.getCause() instanceof CoreException)
+                    OTDebugUIPlugin.getExceptionHandler().logCoreException("Error creating type hiearchy", (CoreException) ex.getCause()); //$NON-NLS-1$
+                else
+                    OTDebugUIPlugin.getExceptionHandler().logException("Error creating type hiearchy", ex); //$NON-NLS-1$
+            }
+            catch (InterruptedException ex)
+            {
+                OTDebugUIPlugin.getExceptionHandler().logException("Error creating type hiearchy", ex); //$NON-NLS-1$
+            }
+            
+            return _subClasses;
+        }
+    }
+
+    /** 
+     * Watch for changes of the ENABLED attribute of breakpoint markers.
+     * 
+     * @param event the change event.
+     */
+	public void resourceChanged(IResourceChangeEvent event) 
+	{
+		IMarkerDelta[] markerDeltas = event.findMarkerDeltas(IBreakpoint.BREAKPOINT_MARKER, true);
+		if (markerDeltas == null) 
+			return;
+		for (IMarkerDelta markerDelta : markerDeltas) {
+			if (markerDelta.getKind() == IResourceDelta.CHANGED) {
+				IMarker marker = markerDelta.getMarker();
+				final Boolean oldEnabled = markerDelta.getAttribute(IBreakpoint.ENABLED, Boolean.FALSE);
+				final Boolean newEnabled = marker.getAttribute(IBreakpoint.ENABLED, Boolean.FALSE);
+				if (!oldEnabled.equals(newEnabled)) {
+					// we have a change wrt enablement
+					List<IJavaBreakpoint> breakpoints = this.copiedBreakpoints.get(marker);
+			    	if (breakpoints != null) {
+						for (final IJavaBreakpoint copy : breakpoints) {
+							Job job = new Job(BreakpointMessages.CopyInheritanceBreakpointManager_toggle_enablement_job) {
+								protected IStatus run(IProgressMonitor monitor) {
+									try {
+										copy.setEnabled(newEnabled);
+										return Status.OK_STATUS;
+									} catch (CoreException e) {
+										return new Status(IStatus.ERROR, OTDebugUIPlugin.PLUGIN_ID, "Error toggling copied breakpoint enablement", e); //$NON-NLS-1$
+									}
+								}
+							};
+							job.setRule(event.getResource());
+							job.schedule();
+						}
+					}
+				}
+			}
+		}
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/OTDebugElementAdapterFactory.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/OTDebugElementAdapterFactory.java
new file mode 100644
index 0000000..2e3c4be
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/OTDebugElementAdapterFactory.java
@@ -0,0 +1,94 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,

+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugElementAdapterFactory.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/

+package org.eclipse.objectteams.otdt.debug.ui.internal;

+

+import org.eclipse.core.runtime.IAdapterFactory;

+import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;

+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;

+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;

+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;

+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.TeamInstance;
+import org.eclipse.objectteams.otdt.debug.ui.internal.model.OTDebugElementsContainerContentProvider;
+import org.eclipse.objectteams.otdt.debug.ui.internal.model.OTDebugElementsContainerLabelProvider;
+import org.eclipse.objectteams.otdt.debug.ui.internal.model.OTDefaultModelProxyFactory;
+import org.eclipse.objectteams.otdt.debug.ui.internal.model.OTVariableColumnFactoryAdapter;
+import org.eclipse.objectteams.otdt.debug.ui.internal.model.TeamInstanceContentProvider;
+import org.eclipse.objectteams.otdt.debug.ui.internal.model.TeamInstanceLabelProvider;
+

+/** 

+ * This factory installs our content/label providers into the TeamView

+ */

+public class OTDebugElementAdapterFactory implements IAdapterFactory 

+{

+	

+	private static IModelProxyFactory fgModelProxyFactoryAdapter= new OTDefaultModelProxyFactory();

+	private static IColumnPresentationFactory fgVariableColumnFactory = new OTVariableColumnFactoryAdapter();

+

+    private static IElementLabelProvider   _LPElementContainer= new OTDebugElementsContainerLabelProvider();

+	private static IElementLabelProvider   _LPTeamInstance=     new TeamInstanceLabelProvider();

+    

+	private static IElementContentProvider _CPElementContainer= new OTDebugElementsContainerContentProvider();

+    private static IElementContentProvider _CPTeamInstance=     new TeamInstanceContentProvider();

+

+

+	public Object getAdapter(Object adaptableObject, Class adapterType)

+	{ 

+        if (adapterType.equals(IElementContentProvider.class)) 

+        {

+        	if(adaptableObject instanceof OTDebugElementsContainer)

+        		return _CPElementContainer;

+

+        	if(adaptableObject instanceof TeamInstance)

+        		return _CPTeamInstance;

+        }

+        

+        if (adapterType.equals(IElementLabelProvider.class))

+        {

+        	if(adaptableObject instanceof OTDebugElementsContainer)

+        		return _LPElementContainer;

+

+        	if(adaptableObject instanceof TeamInstance)

+        		return _LPTeamInstance;

+        }

+        if (adapterType.equals(IModelProxyFactory.class)) {

+        	if (adaptableObject instanceof OTDebugElementsContainer)

+        		return fgModelProxyFactoryAdapter;

+        }

+

+        if (adapterType.equals(IColumnPresentationFactory.class)) {

+        	if (adaptableObject instanceof OTDebugElementsContainer) {

+        		return fgVariableColumnFactory;

+        	}

+        }

+        

+		return null;

+	}

+

+	public Class[] getAdapterList()

+	{

+		return new Class[]{IElementContentProvider.class,

+						   IElementLabelProvider.class,

+						   IModelProxyFactory.class,

+						   IColumnPresentationFactory.class};

+	}

+

+}

diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ActionMessages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ActionMessages.java
new file mode 100644
index 0000000..51ba74a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ActionMessages.java
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ActionMessages.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ActionMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.debug.ui.internal.actions.ActionMessages"; //$NON-NLS-1$
+	public static String ChangeTeamActivationAction_activate_label;
+	public static String ChangeTeamActivationAction_activate_description;
+	public static String ChangeTeamActivationAction_deactivate_label;
+	public static String ChangeTeamActivationAction_deactivate_description;
+	public static String ChangeTeamActivationAction_error_title;
+	public static String ChangeTeamActivationAction_error_exception;
+	public static String ChangeTeamActivationAction_error_no_thread_suspended;
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
+	}
+
+	private ActionMessages() {
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ActionMessages.properties b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ActionMessages.properties
new file mode 100644
index 0000000..ad558f3
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ActionMessages.properties
@@ -0,0 +1,7 @@
+ChangeTeamActivationAction_activate_label=Activate Team
+ChangeTeamActivationAction_activate_description=Activate this team for the selected thread
+ChangeTeamActivationAction_deactivate_label=Deactivate Team
+ChangeTeamActivationAction_deactivate_description=Deactivate this team for the selected thread
+ChangeTeamActivationAction_error_title=Debug operation failed
+ChangeTeamActivationAction_error_no_thread_suspended=Unable to change team activation:\n\nNo thread is suspended to perform this operation.
+ChangeTeamActivationAction_error_exception=Unable to change team activation.
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ChangeTeamActivationAction.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ChangeTeamActivationAction.java
new file mode 100644
index 0000000..b5ec97c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/ChangeTeamActivationAction.java
@@ -0,0 +1,176 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: ChangeTeamActivationAction.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.jdt.debug.core.IJavaFieldVariable;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.objectteams.otdt.debug.TeamInstance;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugImages;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+import org.eclipse.objectteams.otdt.debug.ui.views.TeamView;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+public class ChangeTeamActivationAction extends SelectionProviderAction {
+
+	// selectors of methods to invoke:
+	private static final String DEACTIVATE = "deactivate"; //$NON-NLS-1$
+	private static final String ACTIVATE = "activate"; //$NON-NLS-1$
+	// signatures of (de)activate() methods:
+	private static final String SIGNATURE = "()V"; //$NON-NLS-1$
+	private static final String SIGNATURE_THREAD_ARG = "(Ljava/lang/Thread;)V"; //$NON-NLS-1$
+	// for constant org.objectteams.Team.ALL_THREADS:
+	private static final String ALL_THREADS = "ALL_THREADS"; //$NON-NLS-1$
+
+	protected IVariable fVariable;
+    private TeamView fView;
+    String selector;
+    private boolean isActivate;
+	
+    /**
+     * Creates a new ChangeTeamActivationAction for the given variables view
+     * @param view the variables view in which this action will appear
+     */
+	public ChangeTeamActivationAction(TeamView view, boolean isActivate) {
+		super(view.getViewer(), isActivate
+									? ActionMessages.ChangeTeamActivationAction_activate_label
+									: ActionMessages.ChangeTeamActivationAction_deactivate_label); 
+		this.selector= isActivate ? ACTIVATE : DEACTIVATE;
+		this.isActivate= isActivate;
+		this.setEnabled(false);
+		
+		if (isActivate) {
+			setDescription(ActionMessages.ChangeTeamActivationAction_activate_description); 
+			setImageDescriptor(OTDebugImages.get(OTDebugImages.TEAM_ACTIVATED));
+		} else {
+			setDescription(ActionMessages.ChangeTeamActivationAction_deactivate_description); 
+			setImageDescriptor(OTDebugImages.get(OTDebugImages.TEAM_INACTIVATED));
+		}
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(
+			this,
+			IDebugHelpContextIds.CHANGE_VALUE_ACTION);
+		fView= view;
+	}
+	
+	protected void doActionPerformed(Object element)
+	{
+		if (! (element instanceof TeamInstance))
+			return;
+		TeamInstance teamInstance= (TeamInstance)element;
+		try {
+			IValue value= teamInstance.getValue();
+			if (value instanceof IJavaObject) {
+				IJavaObject teamObject= (IJavaObject) value;
+				String methodSignature = SIGNATURE; // default
+				IJavaValue[] args= null;			// default
+				IJavaThread thread= fView.getSelectedThread();
+				if (thread == null) {
+					// no thread selected means: (de)activate for all threads.
+					methodSignature= SIGNATURE_THREAD_ARG;
+					
+					// create argument ALL_THREADS
+					IJavaFieldVariable field= teamObject.getField(ALL_THREADS, true);
+					args= new IJavaValue[]{(IJavaValue) field.getValue()};
+					
+					// search for a suspended thread:
+					IDebugTarget target= teamObject.getDebugTarget();
+					for (IThread tThread: target.getThreads()) {
+						if (tThread.isSuspended()) {
+							thread= (IJavaThread)tThread;
+							break;
+						}
+					}
+					if (thread == null) {
+						String cause= ActionMessages.ChangeTeamActivationAction_error_no_thread_suspended;
+						DebugUIPlugin.errorDialog(fView.getViewSite().getShell(), 
+								ActionMessages.ChangeTeamActivationAction_error_title,
+								cause,
+								new Status(Status.ERROR, OTDebugUIPlugin.PLUGIN_ID, cause));
+						return;
+					}
+				}
+				teamObject.sendMessage(this.selector, methodSignature, args, thread, false);
+				Viewer viewer = fView.getViewer();
+				viewer.setSelection(viewer.getSelection()); // refresh action enablement
+			}
+		} catch (DebugException de) {
+			DebugUIPlugin.errorDialog(fView.getViewSite().getShell(), 
+					ActionMessages.ChangeTeamActivationAction_error_title,
+					ActionMessages.ChangeTeamActivationAction_error_exception,
+					de);	 
+		}
+	}
+			
+	/**
+	 * Updates the enabled state of this action based
+	 * on the selection
+	 */
+	protected void update(IStructuredSelection sel) {
+		if (sel.size() > 1) {
+			setEnabled(false); // can only activate one team at a time.
+			return;
+		}
+		Iterator iter= sel.iterator();
+		if (iter.hasNext()) {
+			Object object= iter.next();
+			if (object instanceof TeamInstance) {
+				TeamInstance instance= (TeamInstance)object;
+				if (   instance.isActiveFor(fView.getSelectedThread())
+					!= isActivate) 
+				{
+					setEnabled(true);
+					return;
+				}
+			}
+		}
+		setEnabled(false); // no team instance selected
+	}
+
+	/**
+	 * @see IAction#run()
+	 */
+	public void run() {
+		Iterator iterator= getStructuredSelection().iterator();
+		doActionPerformed(iterator.next());
+	}
+	
+	/**
+	 * @see SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
+	 */
+	public void selectionChanged(IStructuredSelection sel) {
+		update(sel);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTBreakpointLocationVerifierJob.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTBreakpointLocationVerifierJob.java
new file mode 100644
index 0000000..d27cadc
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTBreakpointLocationVerifierJob.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTBreakpointLocationVerifierJob.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Fraunhofer FIRST - extended API and implementation
+ *     Technical University Berlin - extended API and implementation
+ *******************************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
+import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
+import org.eclipse.jdt.internal.debug.ui.actions.ActionMessages;
+import org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.texteditor.IEditorStatusLine;
+
+/**
+ * Job used to verify the position of a breakpoint
+ * copied from BreakpointLocationVerifierJob
+ * $Id: OTBreakpointLocationVerifierJob.java 23432 2010-02-03 23:13:42Z stephan $
+ */
+//{OT_COPY_PASTE: class copied from org.eclipse.jdt.internal.debug.ui.actions.BreakpointLocationVerifierJob
+// modified just to instantiate OTValidBreakpointLocationLocator in favor of ValidBreakpointLocationLocator
+public class OTBreakpointLocationVerifierJob extends Job {
+
+	/**
+	 * The document which contains the code source.
+	 */
+	private IDocument fDocument;
+	
+	/**
+	 * The temporary breakpoint that has been set. Can be <code>null</code> if the callee was not able
+	 * to check if a breakpoint was already set at this position.
+	 */	
+	private IJavaLineBreakpoint fBreakpoint;
+	
+	/**
+	 * The number of the line where the breakpoint has been requested.
+	 */
+	private int fLineNumber;
+	
+	/**
+	 * The qualified type name of the class where the temporary breakpoint as been set.
+	 * Can be <code>null</code> if fBreakpoint is null.
+	 */	
+	private String fTypeName;
+	
+	/**
+	 * The type in which should be set the breakpoint.
+	 */
+	private IType fType;
+	
+	/**
+	 * Indicate if the search for a valid location should be limited to a line
+	 * or expanded to field and method declaration.
+	 */
+	private boolean fBestMatch;
+
+	/**
+	 * The resource in which should be set the breakpoint.
+	 */
+	private IResource fResource;
+	
+	/**
+	 * The current IEditorPart
+	 */
+	private IEditorPart fEditorPart;
+	
+	/**
+	 * The status line to use to display errors
+	 */
+	private IEditorStatusLine fStatusLine;
+
+	public OTBreakpointLocationVerifierJob(IDocument document, IJavaLineBreakpoint breakpoint, int lineNumber, boolean bestMatch, String typeName, IType type, IResource resource, IEditorPart editorPart) {
+		super(ActionMessages.BreakpointLocationVerifierJob_breakpoint_location); 
+		fDocument= document;
+		fBreakpoint= breakpoint;
+		fLineNumber= lineNumber;
+		fBestMatch= bestMatch;
+		fTypeName= typeName;
+		fType= type;
+		fResource= resource;
+		fEditorPart= editorPart;
+		fStatusLine= (IEditorStatusLine) editorPart.getAdapter(IEditorStatusLine.class);
+		setSystem(true);
+	}
+	
+	public IStatus run(IProgressMonitor monitor) {
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		char[] source = fDocument.get().toCharArray();
+		parser.setSource(source);
+		IJavaElement javaElement = JavaCore.create(fResource);
+		IJavaProject project= null;
+		if (javaElement != null) {
+			Map options=JavaCore.getDefaultOptions();
+            project= javaElement.getJavaProject();
+            String compilerCompliance = JavaCore.VERSION_1_5;
+            String compilerSource = JavaCore.VERSION_1_5;
+            if (project != null) {
+                compilerCompliance = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+                compilerSource = project.getOption(JavaCore.COMPILER_SOURCE, true);
+            }
+            options.put(JavaCore.COMPILER_COMPLIANCE, compilerCompliance);
+            options.put(JavaCore.COMPILER_SOURCE, compilerSource);
+			parser.setCompilerOptions(options);
+		}
+		CompilationUnit compilationUnit= (CompilationUnit)parser.createAST(null);
+//{ObjectTeams: replace ValidBreakpointLocationLocator with own OTValidBreakpointLocationLocator
+		OTValidBreakpointLocationLocator locator= new OTValidBreakpointLocationLocator(compilationUnit, fLineNumber, false, fBestMatch);
+//ike}
+		compilationUnit.accept(locator);
+		if (locator.isBindingsRequired()) {
+			if (javaElement != null) {
+				// try again with bindings if required and available
+				String unitName = null;
+				if (fType == null) {
+					String name = fResource.getName();
+					if (JavaCore.isJavaLikeFileName(name)) {
+						unitName = name;
+					}
+				} else {
+					if (fType.isBinary()) {
+						String className= fType.getClassFile().getElementName();
+						int nameLength= className.indexOf('$');
+						if (nameLength < 0) {
+							nameLength= className.indexOf('.');
+						}
+						unitName= className.substring(0, nameLength) + ".java"; //$NON-NLS-1$
+					} else {
+						unitName= fType.getCompilationUnit().getElementName();
+					}
+				}
+				if (unitName != null) {
+					parser = ASTParser.newParser(AST.JLS3);
+					parser.setSource(source);
+					parser.setProject(project);
+					parser.setUnitName(unitName);
+					parser.setResolveBindings(true);
+					compilationUnit= (CompilationUnit)parser.createAST(null);
+//{ObjectTeams: replace ValidBreakpointLocationLocator with own OTValidBreakpointLocationLocator
+					locator= new OTValidBreakpointLocationLocator(compilationUnit, fLineNumber, true, fBestMatch);
+//ike}
+					compilationUnit.accept(locator);
+				}
+			}
+		}
+		int lineNumber= locator.getLineLocation();		
+		String typeName= locator.getFullyQualifiedTypeName();
+		
+		try {
+			switch (locator.getLocationType()) {
+				case ValidBreakpointLocationLocator.LOCATION_LINE:
+					return manageLineBreakpoint(typeName, lineNumber);
+				case ValidBreakpointLocationLocator.LOCATION_METHOD:
+					if (fBreakpoint != null) {
+						DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(fBreakpoint, true);
+					}
+//{ObjectTeams use OTToggleBreakpointAdapter
+					new OTToggleBreakpointAdapter().toggleMethodBreakpoints(fEditorPart, new TextSelection(locator.getMemberOffset(), 0));
+//carp}
+					break;
+				case ValidBreakpointLocationLocator.LOCATION_FIELD:
+					if (fBreakpoint != null) {
+						DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(fBreakpoint, true);
+					}
+//{ObjectTeams use OTToggleBreakpointAdapter
+					new OTToggleBreakpointAdapter().toggleWatchpoints(fEditorPart, new TextSelection(locator.getMemberOffset(), 0));
+//carp}
+					break;
+				default:
+					// cannot find a valid location
+					report(ActionMessages.BreakpointLocationVerifierJob_not_valid_location); 
+					if (fBreakpoint != null) {
+						DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(fBreakpoint, true);
+					}
+					return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, ActionMessages.BreakpointLocationVerifierJob_not_valid_location, null); 
+			}
+		} catch (CoreException e) {
+			JDIDebugUIPlugin.log(e);
+		}
+		return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.OK, ActionMessages.BreakpointLocationVerifierJob_breakpoint_set, null); 
+		
+	}
+	
+	/**
+	 * Determines the placement of the line breakpoint, and ensures that duplicates are not created
+	 * and that notification is sent in the event of collisions
+	 * @param typeName the fully qualified name of the type to add the line breakpoint to
+	 * @param lineNumber the number we wish to put the breakpoint on
+	 * @return the status of the line breakpoint placement
+	 */
+	public IStatus manageLineBreakpoint(String typeName, int lineNumber) {
+		try {
+			boolean differentLineNumber= lineNumber != fLineNumber;
+			IJavaLineBreakpoint breakpoint= JDIDebugModel.lineBreakpointExists(fResource, typeName, lineNumber);
+			boolean breakpointExist= breakpoint != null;
+			if (fBreakpoint == null) {
+				if (breakpointExist) {
+					if (differentLineNumber) {
+						// There is already a breakpoint on the valid line.
+						report(MessageFormat.format(ActionMessages.BreakpointLocationVerifierJob_0, new String[]{Integer.toString(lineNumber)}));
+						return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, ActionMessages.BreakpointLocationVerifierJob_not_valid_location, null); 
+					}
+					// There is already a breakpoint on the valid line, but it's also the requested line.
+					// Removing the existing breakpoint.
+					DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(breakpoint, true);
+					return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.OK, ActionMessages.BreakpointLocationVerifierJob_breakpointRemoved, null); 
+				}
+				createNewBreakpoint(lineNumber, typeName);
+				return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.OK, ActionMessages.BreakpointLocationVerifierJob_breakpoint_set, null); 
+			}
+			if (differentLineNumber) {
+				if (breakpointExist) {
+					// there is already a breakpoint on the valid line.
+					DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(fBreakpoint, true);
+					report(MessageFormat.format(ActionMessages.BreakpointLocationVerifierJob_0, new String[]{Integer.toString(lineNumber)})); 
+					return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, ActionMessages.BreakpointLocationVerifierJob_not_valid_location, null); 
+				}
+				replaceBreakpoint(lineNumber, typeName);
+				return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.WARNING, ActionMessages.BreakpointLocationVerifierJob_breakpointMovedToValidPosition, null); 
+			}
+			if (!typeName.equals(fTypeName)) {
+				replaceBreakpoint(lineNumber, typeName);
+				return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.WARNING, ActionMessages.BreakpointLocationVerifierJob_breakpointSetToRightType, null); 
+			}
+		} catch (CoreException e) {
+			JDIDebugUIPlugin.log(e);
+		}
+		return new Status(IStatus.OK, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.OK, ActionMessages.BreakpointLocationVerifierJob_breakpoint_set, null); 
+	}
+	
+	/**
+	 * Remove the temporary breakpoint and create a new breakpoint at the right position.
+	 */
+	private void replaceBreakpoint(int lineNumber, String typeName) throws CoreException {
+		createNewBreakpoint(lineNumber, typeName);
+		DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(fBreakpoint, true);
+	}
+
+	/**
+	 * Create a new breakpoint at the right position.
+	 */
+	private void createNewBreakpoint(int lineNumber, String typeName) throws CoreException {
+		Map newAttributes = new HashMap(10);
+		if (fType != null) {
+			try {
+				IRegion line= fDocument.getLineInformation(lineNumber - 1);
+				int start= line.getOffset();
+				int end= start + line.getLength() - 1;
+				BreakpointUtils.addJavaBreakpointAttributesWithMemberDetails(newAttributes, fType, start, end);
+			} catch (BadLocationException ble) {
+				JDIDebugUIPlugin.log(ble);
+			}
+		}
+		JDIDebugModel.createLineBreakpoint(fResource, typeName, lineNumber, -1, -1, 0, true, newAttributes);
+	}
+
+	/**
+	 * Reports any status to the current active workbench shell
+	 * @param message the message to display
+	 */
+	protected void report(final String message) {
+		JDIDebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+			public void run() {
+				if (fStatusLine != null) {
+					fStatusLine.setMessage(true, message, null);
+				}
+				if (message != null && JDIDebugUIPlugin.getActiveWorkbenchShell() != null) {
+					Display.getCurrent().beep();
+				}
+			}
+		});
+	}
+}
+//ike}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTToggleBreakpointAdapter.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTToggleBreakpointAdapter.java
new file mode 100644
index 0000000..bba4f4f
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTToggleBreakpointAdapter.java
@@ -0,0 +1,1243 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTToggleBreakpointAdapter.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Fraunhofer FIRST - extended API and implementation
+ *     Technical University Berlin - extended API and implementation
+ *******************************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageDeclaration;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.debug.core.IJavaBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaClassPrepareBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaFieldVariable;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaWatchpoint;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.jdt.internal.debug.core.JavaDebugUtils;
+import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
+import org.eclipse.jdt.internal.debug.ui.DebugWorkingCopyManager;
+import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
+import org.eclipse.jdt.internal.debug.ui.actions.ActionDelegateHelper;
+import org.eclipse.jdt.internal.debug.ui.actions.ActionMessages;
+import org.eclipse.jdt.ui.IWorkingCopyManager;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.IEditorStatusLine;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.objectteams.otdt.core.IOTJavaElement;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+
+/**
+ * @author ike
+ * Toggles a line breakpoint in a OTJava editor.
+ * 
+ * @since 3.0
+ */
+//{OT_COPY_PASTE: class copied from org.eclipse.jdt.internal.debug.ui.actions.ToggleBreakpointAdapter
+// to instantiate OTBreakpointLocationVerifierJob in favor of BreakpointLocationVerifierJob
+// and to access a protected method of ValidBreakpointLocationLocator
+public class OTToggleBreakpointAdapter implements IToggleBreakpointsTargetExtension {
+
+	
+	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+	
+	/**
+	 * Constructor
+	 */
+	public OTToggleBreakpointAdapter() {
+		// initialize helper in UI thread
+		ActionDelegateHelper.getDefault();
+	}
+
+    /**
+     * Convenience method for printing messages to the status line
+     * @param message the message to be displayed
+     * @param part the currently active workbench part
+     */
+    protected void report(final String message, final IWorkbenchPart part) {
+        JDIDebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+            public void run() {
+                IEditorStatusLine statusLine = (IEditorStatusLine) part.getAdapter(IEditorStatusLine.class);
+                if (statusLine != null) {
+                    if (message != null) {
+                        statusLine.setMessage(true, message, null);
+                    } else {
+                        statusLine.setMessage(true, null, null);
+                    }
+                }
+                if (message != null && JDIDebugUIPlugin.getActiveWorkbenchShell() != null) {
+                    JDIDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
+                }
+            }
+        });
+    }
+
+    /**
+     * Returns the <code>IType</code> for the given selection
+     * @param selection the current text selection
+     * @return the <code>IType</code> for the text selection or <code>null</code>
+     */
+    protected IType getType(ITextSelection selection) {
+        IMember member = ActionDelegateHelper.getDefault().getCurrentMember(selection);
+        IType type = null;
+        if (member instanceof IType) {
+            type = (IType) member;
+        } else if (member != null) {
+            type = member.getDeclaringType();
+        }
+        // bug 52385: we don't want local and anonymous types from compilation
+        // unit,
+        // we are getting 'not-always-correct' names for them.
+        try {
+            while (type != null && !type.isBinary() && type.isLocal()) {
+                type = type.getDeclaringType();
+            }
+        } catch (JavaModelException e) {
+            JDIDebugUIPlugin.log(e);
+        }
+        return type;
+    }
+
+    /**
+     * Returns the IType associated with the <code>IJavaElement</code> passed in
+     * @param element the <code>IJavaElement</code> to get the type from
+     * @return the corresponding <code>IType</code> for the <code>IJavaElement</code>, or <code>null</code> if there is not one.
+     * @since 3.3
+     */
+    protected IType getType(IJavaElement element) {
+    	switch(element.getElementType()) {
+	    	case IJavaElement.FIELD: {
+	    		return ((IField)element).getDeclaringType();
+	    	}	
+	    	case IJavaElement.METHOD: {
+	    		return ((IMethod)element).getDeclaringType();
+	    	}
+	    	case IJavaElement.TYPE: {
+	    		return (IType)element;
+	    	}
+	    	default: {
+	    		return null;
+	    	}
+    	}
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+     */
+    public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+    	toggleLineBreakpoints(part, selection, false);
+    }
+    
+    /**
+     * Toggles a line breakpoint.
+     * @param part the currently active workbench part 
+     * @param selection the current selection
+     * @param bestMatch if we should make a best match or not
+     */
+    public void toggleLineBreakpoints(final IWorkbenchPart part, final ISelection selection, final boolean bestMatch) {
+        Job job = new Job("Toggle Line Breakpoint") { //$NON-NLS-1$
+            protected IStatus run(IProgressMonitor monitor) {
+            	ITextEditor editor = getTextEditor(part);
+                if (editor != null && selection instanceof ITextSelection) {
+                    if (monitor.isCanceled()) {
+                        return Status.CANCEL_STATUS;
+                    }
+                    try {
+	                    report(null, part);
+	                    ISelection sel = selection;
+	                	if(!(selection instanceof IStructuredSelection)) {
+	                		sel = translateToMembers(part, selection);
+	                	}
+	                	if(isInterface(sel, part)) {
+	                		report(ActionMessages.ToggleBreakpointAdapter_6, part);
+	                    	return Status.OK_STATUS;
+	                	}
+	                    if(sel instanceof IStructuredSelection) {
+	                    	IMember member = (IMember) ((IStructuredSelection)sel).getFirstElement();
+	                    	IType type = null;
+//{ObjectTeams: also handle IOTJavaElement.{ROLE,TEAM}:
+/* orig:
+	                    	if(member.getElementType() == IJavaElement.TYPE) {
+  :giro */
+	                    	if(member instanceof IType) {
+// SH}
+	                    		type = (IType) member;
+	                    	}
+	                    	else {
+	                    		type = member.getDeclaringType();
+	                    	}
+	                    	String tname = createQualifiedTypeName(type);
+	                    	IResource resource = BreakpointUtils.getBreakpointResource(type);
+							int lnumber = ((ITextSelection) selection).getStartLine() + 1;
+							IJavaLineBreakpoint existingBreakpoint = JDIDebugModel.lineBreakpointExists(resource, tname, lnumber);
+							if (existingBreakpoint != null) {
+								DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(existingBreakpoint, true);
+								return Status.OK_STATUS;
+							}
+							Map attributes = new HashMap(10);
+							IDocumentProvider documentProvider = editor.getDocumentProvider();
+							if (documentProvider == null) {
+							    return Status.CANCEL_STATUS;
+							}
+							IDocument document = documentProvider.getDocument(editor.getEditorInput());
+							try {
+								IRegion line = document.getLineInformation(lnumber - 1);
+								int start = line.getOffset();
+								int end = start + line.getLength() - 1;
+								BreakpointUtils.addJavaBreakpointAttributesWithMemberDetails(attributes, type, start, end);
+							} 	
+							catch (BadLocationException ble) {JDIDebugUIPlugin.log(ble);}
+							IJavaLineBreakpoint breakpoint = JDIDebugModel.createLineBreakpoint(resource, tname, lnumber, -1, -1, 0, true, attributes);
+//{ObjectTeams: replace BreakpointLocationVerifierJob with own OTBreakpointLocationVerifierJob
+							new OTBreakpointLocationVerifierJob(document, breakpoint, lnumber, bestMatch, tname, type, resource, editor).schedule();
+// ike}							
+	                    }
+	                    else {
+	                    	report(ActionMessages.ToggleBreakpointAdapter_3, part);
+	                    	return Status.OK_STATUS;
+	                    }
+                    } 
+                    catch (CoreException ce) {return ce.getStatus();}
+                }
+                return Status.OK_STATUS;
+            }
+        };
+        job.setSystem(true);
+        job.schedule();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(IWorkbenchPart,
+     *      ISelection)
+     */
+    public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
+    	if (isRemote(part, selection)) {
+    		return false;
+    	}
+        return selection instanceof ITextSelection;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public void toggleMethodBreakpoints(final IWorkbenchPart part, final ISelection finalSelection) {
+        Job job = new Job("Toggle Method Breakpoints") { //$NON-NLS-1$
+            protected IStatus run(IProgressMonitor monitor) {
+                if (monitor.isCanceled()) {
+                    return Status.CANCEL_STATUS;
+                }
+                try {
+                    report(null, part);
+                    ISelection selection = finalSelection;
+                    if(!(selection instanceof IStructuredSelection)) {
+                    	selection = translateToMembers(part, selection);
+                    }
+                    if(isInterface(selection, part)) {
+                    	report(ActionMessages.ToggleBreakpointAdapter_7, part);
+                    	return Status.OK_STATUS;
+                    }
+                    if (selection instanceof IStructuredSelection) {
+                        IMethod[] members = getMethods((IStructuredSelection) selection);
+                        if (members.length == 0) {
+                            report(ActionMessages.ToggleBreakpointAdapter_9, part); 
+                            return Status.OK_STATUS;
+                        }
+                        IJavaBreakpoint breakpoint = null;
+                        ISourceRange range = null;
+                        Map attributes = null;
+                        IType type = null;
+                        String signature = null;
+                        String mname = null;
+                        for (int i = 0, length = members.length; i < length; i++) {
+                            breakpoint = getMethodBreakpoint(members[i]);
+                            if (breakpoint == null) {
+                                int start = -1;
+                                int end = -1;
+                                range = members[i].getNameRange();
+                                if (range != null) {
+                                    start = range.getOffset();
+                                    end = start + range.getLength();
+                                }
+                                attributes = new HashMap(10);
+                                BreakpointUtils.addJavaBreakpointAttributes(attributes, members[i]);
+                                type = members[i].getDeclaringType();
+                                signature = members[i].getSignature();
+                                mname = members[i].getElementName();
+                                if (members[i].isConstructor()) {
+                                	mname = "<init>"; //$NON-NLS-1$
+                                    if (type.isEnum()) {
+                                    	signature = "(Ljava.lang.String;I" + signature.substring(1); //$NON-NLS-1$
+                                    }
+                                }
+                                if (!type.isBinary()) {
+                                	signature = resolveMethodSignature(members[i]);
+                                    if (signature == null) {
+                                    	report(ActionMessages.ManageMethodBreakpointActionDelegate_methodNonAvailable, part); 
+                                        return Status.OK_STATUS;
+                                    }
+                                }
+                                JDIDebugModel.createMethodBreakpoint(BreakpointUtils.getBreakpointResource(members[i]), createQualifiedTypeName(type), mname, signature, true, false, false, -1, start, end, 0, true, attributes);
+                            } else {
+                            	DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(breakpoint, true);
+                            }
+                        }
+                    }
+                    else {
+                    	report(ActionMessages.ToggleBreakpointAdapter_4, part);
+                    	return Status.OK_STATUS;
+                    }
+                } catch (CoreException e) {
+                    return e.getStatus();
+                }
+                return Status.OK_STATUS;
+            }
+        };
+        job.setSystem(true);
+        job.schedule();
+    }
+    
+    /**
+     * Toggles a class load breakpoint
+     * @param part the part
+     * @param selection the current selection
+     * @since 3.3
+     */
+    public void toggleClassBreakpoints(final IWorkbenchPart part, final ISelection selection) {
+    	Job job = new Job("Toggle Class Load Breakpoints") { //$NON-NLS-1$
+			protected IStatus run(IProgressMonitor monitor) {
+				if (monitor.isCanceled()) {
+                    return Status.CANCEL_STATUS;
+                }
+                try {
+                	report(null, part);
+                	ISelection sel = selection;
+                	if(!(selection instanceof IStructuredSelection)) {
+                		sel = translateToMembers(part, selection);
+                	}
+                	if(isInterface(sel, part)) {
+                    	report(ActionMessages.ToggleBreakpointAdapter_1, part);
+                    	return Status.OK_STATUS;
+                    }
+					if(sel instanceof IStructuredSelection) {
+						IMember member = (IMember)((IStructuredSelection)sel).getFirstElement();
+						IType type = (IType) member;
+						IBreakpoint existing = getClassLoadBreakpoint(type);
+						if (existing != null) {
+							existing.delete(); 
+						}
+						else {
+							HashMap map = new HashMap(10);
+							BreakpointUtils.addJavaBreakpointAttributes(map, type);
+							ISourceRange range= type.getNameRange();
+							int start = -1;
+							int end = -1;
+							if (range != null) {
+								start = range.getOffset();
+								end = start + range.getLength();
+							}
+							JDIDebugModel.createClassPrepareBreakpoint(BreakpointUtils.getBreakpointResource(member), createQualifiedTypeName(type), IJavaClassPrepareBreakpoint.TYPE_CLASS, start, end, true, map);
+						}
+					}
+					else {
+						report(ActionMessages.ToggleBreakpointAdapter_0, part);
+						return Status.OK_STATUS;
+					}
+				} 
+                catch (CoreException e) {
+					return e.getStatus();
+				}
+				return Status.OK_STATUS;
+			}
+    	};
+    	job.setSystem(true);
+    	job.schedule();
+    }
+    
+    /**
+     * Returns the class load breakpoint for the specified type or null if none found
+     * @param type the type to search for a class load breakpoint for
+     * @return the existing class load breakpoint, or null if none
+     * @throws CoreException
+     * @since 3.3
+     */
+    protected IBreakpoint getClassLoadBreakpoint(IType type) throws CoreException {
+    	IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(JDIDebugModel.getPluginIdentifier());
+    	IBreakpoint existing = null;
+    	IJavaBreakpoint breakpoint = null;
+    	for (int i = 0; i < breakpoints.length; i++) {
+			breakpoint = (IJavaBreakpoint) breakpoints[i];
+			if (breakpoint instanceof IJavaClassPrepareBreakpoint && createQualifiedTypeName(type).equals(breakpoint.getTypeName())) {
+				existing = breakpoint;
+				break;
+			}
+		}
+    	return existing;
+    }
+    	
+    /**
+     * Returns the package qualified name, while accounting for the fact that a source file might
+     * not have a project
+     * @param type the type to ensure the package qualified name is created for
+     * @return the package qualified name
+     * @since 3.3
+     */
+//{ObjectTeams: made API for RoFiBreakpointTests (was private non-static): 
+    public static String createQualifiedTypeName(IType type) {
+// SH}
+    	String tname = pruneAnonymous(type);
+    	try {
+    		String packName = null;
+    		if (type.isBinary()) {
+    			packName = type.getPackageFragment().getElementName();
+    		} else {
+    			IPackageDeclaration[] pd = type.getCompilationUnit().getPackageDeclarations();
+				if(pd.length > 0) {
+					packName = pd[0].getElementName();
+				}
+    		}
+			if(packName != null && !packName.equals(EMPTY_STRING)) {
+//{ObjectTeams: package of a role must be a team package:
+			  if (tname.startsWith(IOTConstants.OT_DELIM))
+				tname =  packName+'$'+tname;
+			  else
+// SH}
+				tname =  packName+"."+tname; //$NON-NLS-1$
+			}
+    	} 
+    	catch (JavaModelException e) {}
+    	return tname;
+    }
+    
+    /**
+     * Prunes out all naming occurrences of anonymous inner types, since these types have no names
+     * and cannot be derived visiting an AST (no positive type name matching while visiting ASTs)
+     * @param type
+     * @return the compiled type name from the given {@link IType} with all occurrences of anonymous inner types removed
+     * @since 3.4
+     */
+    private static String pruneAnonymous(IType type) {
+    	StringBuffer buffer = new StringBuffer();
+    	IJavaElement parent = type;
+    	while(parent != null) {
+    		if(parent.getElementType() == IJavaElement.TYPE){
+    			IType atype = (IType) parent;
+    			try {
+	    			if(!atype.isAnonymous()) {
+	    				if(buffer.length() > 0) {
+	    					buffer.insert(0, '$');
+	    				}
+//{ObjectTeams: use prefixed role type if appropriate:
+// 				cf. OTValidBreakpointLocationLocator.computeTypeName()
+/* orig:
+	    				buffer.insert(0, atype.getElementName());
+  :giro */
+  						buffer.insert(0, getSimpleTypeName(atype));
+// SH}
+	    			}
+    			}
+    			catch(JavaModelException jme) {}
+    		}
+    		parent = parent.getParent();
+    	}
+    	return buffer.toString();
+    }
+        
+//{ObjectTeams: new util:
+    /** Make sure each role type is prefixed with __OT__. */
+    private static String getSimpleTypeName(IType type) {
+    	String name= type.getElementName();
+    	if (name.startsWith(IOTConstants.OT_DELIM))
+    		return name; // already prefixed
+    	
+    	boolean isRole= false;
+    	if (type.getElementType() == IOTJavaElement.ROLE)
+    		isRole= true;
+    	else if (OTModelManager.hasOTElementFor(type)) {
+    		IOTType otType= OTModelManager.getOTElement(type);
+    		isRole= otType.isRole();
+    	}
+    	if (isRole)
+    		return IOTConstants.OT_DELIM + name;
+    	return name;
+	}
+// SH}
+
+    /**
+     * gets the <code>IJavaElement</code> from the editor input
+     * @param input the current editor input
+     * @return the corresponding <code>IJavaElement</code>
+     * @since 3.3
+     */
+    private IJavaElement getJavaElement(IEditorInput input) {
+    	IJavaElement je = JavaUI.getEditorInputJavaElement(input);
+    	if(je != null) {
+    		return je;
+    	}
+    	//try to get from the working copy manager
+    	return DebugWorkingCopyManager.getWorkingCopy(input, false);
+    }
+    
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
+    	if (isRemote(part, selection)) {
+    		return false;
+    	}
+        if (selection instanceof IStructuredSelection) {
+            IStructuredSelection ss = (IStructuredSelection) selection;
+            return getMethods(ss).length > 0;
+        }
+        return (selection instanceof ITextSelection) && isMethod((ITextSelection) selection, part);
+    }
+    
+    /**
+     * Returns whether the given part/selection is remote (viewing a repository)
+     * 
+     * @param part
+     * @param selection
+     * @return
+     */
+    protected boolean isRemote(IWorkbenchPart part, ISelection selection) {
+    	if (selection instanceof IStructuredSelection) {
+			IStructuredSelection ss = (IStructuredSelection) selection;
+			Object element = ss.getFirstElement();
+			if(element instanceof IMember) {
+				IMember member = (IMember) element;
+				return !member.getJavaProject().getProject().exists();
+			}
+		}
+    	ITextEditor editor = getTextEditor(part);
+    	if (editor != null) {
+    		IEditorInput input = editor.getEditorInput();
+    		Object adapter = Platform.getAdapterManager().getAdapter(input, "org.eclipse.team.core.history.IFileRevision"); //$NON-NLS-1$
+    		return adapter != null;
+    	} 
+    	return false;
+    }
+    
+    /**
+     * Returns the text editor associated with the given part or <code>null</code>
+     * if none. In case of a multi-page editor, this method should be used to retrieve
+     * the correct editor to perform the breakpoint operation on.
+     * 
+     * @param part workbench part
+     * @return text editor part or <code>null</code>
+     */
+    protected ITextEditor getTextEditor(IWorkbenchPart part) {
+    	if (part instanceof ITextEditor) {
+    		return (ITextEditor) part;
+    	}
+    	return (ITextEditor) part.getAdapter(ITextEditor.class);
+    }
+
+    /**
+     * Returns the methods from the selection, or an empty array
+     * @param selection the selection to get the methods from
+     * @return an array of the methods from the selection or an empty array
+     */
+    protected IMethod[] getMethods(IStructuredSelection selection) {
+        if (selection.isEmpty()) {
+            return new IMethod[0];
+        }
+        List methods = new ArrayList(selection.size());
+        Iterator iterator = selection.iterator();
+        while (iterator.hasNext()) {
+            Object thing = iterator.next();
+            try {
+                if (thing instanceof IMethod) {
+                	IMethod method = (IMethod) thing;
+                	if (!Flags.isAbstract(method.getFlags())) {
+                		methods.add(method);
+                	}
+                }
+            } 
+            catch (JavaModelException e) {}
+        }
+        return (IMethod[]) methods.toArray(new IMethod[methods.size()]);
+    }
+
+    /**
+     * Returns if the text selection is a valid method or not
+     * @param selection the text selection
+     * @param part the associated workbench part
+     * @return true if the selection is a valid method, false otherwise
+     */
+    private boolean isMethod(ITextSelection selection, IWorkbenchPart part) {
+		ITextEditor editor = getTextEditor(part);
+		if(editor != null) {
+			IJavaElement element = getJavaElement(editor.getEditorInput());
+			if(element != null) {
+				try {
+					if(element instanceof ICompilationUnit) {
+						element = ((ICompilationUnit) element).getElementAt(selection.getOffset());
+					}
+					else if(element instanceof IClassFile) {
+						element = ((IClassFile) element).getElementAt(selection.getOffset());
+					}
+					return element != null && element.getElementType() == IJavaElement.METHOD;
+				} 
+    			catch (JavaModelException e) {return false;}
+			}
+		}
+    	return false;
+    }
+    
+    /**
+     * Returns a list of <code>IField</code> and <code>IJavaFieldVariable</code> in the given selection.
+     * When an <code>IField</code> can be resolved for an <code>IJavaFieldVariable</code>, it is
+     * returned in favour of the variable.
+     *
+     * @param selection
+     * @return list of <code>IField</code> and <code>IJavaFieldVariable</code>, possibly empty
+     * @throws CoreException
+     */
+    protected List getFields(IStructuredSelection selection) throws CoreException {
+        if (selection.isEmpty()) {
+            return Collections.EMPTY_LIST;
+        }
+        List fields = new ArrayList(selection.size());
+        Iterator iterator = selection.iterator();
+        while (iterator.hasNext()) {
+            Object thing = iterator.next();
+            if (thing instanceof IField) {
+                fields.add(thing);
+            } else if (thing instanceof IJavaFieldVariable) {
+                IField field = getField((IJavaFieldVariable) thing);
+                if (field == null) {
+                	fields.add(thing);
+                } else {
+                    fields.add(field);
+                }
+            }
+        }
+        return fields;
+    }
+
+    /**
+     * Returns if the structured selection is itself or is part of an interface
+     * @param selection the current selection
+     * @return true if the selection is part of an interface, false otherwise
+     * @since 3.2
+     */
+    private boolean isInterface(ISelection selection, IWorkbenchPart part) {
+		try {
+			ISelection sel = selection;
+			if(!(sel instanceof IStructuredSelection)) {
+				sel = translateToMembers(part, selection);
+			}
+			if(sel instanceof IStructuredSelection) {
+				Object obj = ((IStructuredSelection)sel).getFirstElement();
+				if(obj instanceof IMember) {
+					IMember member = (IMember) ((IStructuredSelection)sel).getFirstElement();
+					if(member.getElementType() == IJavaElement.TYPE) {
+						return ((IType)member).isInterface();
+					}
+					return member.getDeclaringType().isInterface();
+				}
+				else if(obj instanceof IJavaFieldVariable) {
+					IJavaFieldVariable var = (IJavaFieldVariable) obj;
+					IType type = JavaDebugUtils.resolveType(var.getDeclaringType());
+					return type != null && type.isInterface();
+				}
+			}
+		} 
+		catch (CoreException e1) {}
+    	return false;
+    }
+    
+    /**
+     * Returns if the text selection is a field selection or not
+     * @param selection the text selection
+     * @param part the associated workbench part
+     * @return true if the text selection is a valid field for a watchpoint, false otherwise
+     * @since 3.3
+     */
+    private boolean isField(ITextSelection selection, IWorkbenchPart part) {
+    	ITextEditor editor = getTextEditor(part);
+    	if(editor != null) {
+    		IJavaElement element = getJavaElement(editor.getEditorInput());
+    		if(element != null) {
+    			try {
+	    			if(element instanceof ICompilationUnit) {
+						element = ((ICompilationUnit) element).getElementAt(selection.getOffset());
+	    			}
+	    			else if(element instanceof IClassFile) {
+	    				element = ((IClassFile) element).getElementAt(selection.getOffset());
+	    			}
+	    			return element != null && element.getElementType() == IJavaElement.FIELD;
+				} 
+    			catch (JavaModelException e) {return false;}		
+    		}
+    	}
+    	return false;
+    }
+    
+    /**
+     * Determines if the selection is a field or not
+     * @param selection the current selection
+     * @return true if the selection is a field false otherwise
+     */
+    private boolean isFields(IStructuredSelection selection) {
+        if (!selection.isEmpty()) {
+        	try {
+	            Iterator iterator = selection.iterator();
+	            while (iterator.hasNext()) {
+	                Object thing = iterator.next();
+	                if (thing instanceof IField) {
+	                	int flags = ((IField)thing).getFlags();
+	                	return !Flags.isFinal(flags) & !(Flags.isFinal(flags) & Flags.isStatic(flags));
+	                }
+	                else if(thing instanceof IJavaFieldVariable) {
+	                	IJavaFieldVariable fv = (IJavaFieldVariable)thing;
+	                	return !fv.isFinal() & !(fv.isFinal() & fv.isStatic());
+	                }
+	            }
+        	}
+        	catch(JavaModelException e) {return false;}
+        	catch(DebugException de) {return false;}
+        }
+        return false;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public void toggleWatchpoints(final IWorkbenchPart part, final ISelection finalSelection) {
+        Job job = new Job("Toggle Watchpoints") { //$NON-NLS-1$
+            protected IStatus run(IProgressMonitor monitor) {
+                if (monitor.isCanceled()) {
+                    return Status.CANCEL_STATUS;
+                }
+                try {
+                    report(null, part);
+                    ISelection selection = finalSelection;
+                    if(!(selection instanceof IStructuredSelection)) {
+                    	selection = translateToMembers(part, finalSelection);
+                    }
+                    if(isInterface(selection, part)) {
+                		report(ActionMessages.ToggleBreakpointAdapter_5, part);
+                		return Status.OK_STATUS;
+                	}
+                    boolean allowed = false;
+	                if (selection instanceof IStructuredSelection) {
+	                	List fields = getFields((IStructuredSelection) selection);
+	                    if (fields.isEmpty()) {
+	                        report(ActionMessages.ToggleBreakpointAdapter_10, part); 
+	                        return Status.OK_STATUS;
+	                    }
+	                    Iterator theFields = fields.iterator();
+	                    IField javaField = null;
+	                    IResource resource = null;
+                        String typeName = null;
+                        String fieldName = null;
+                        Object element = null;
+                        Map attributes = null;
+                        IJavaBreakpoint breakpoint = null;
+	                    while (theFields.hasNext()) {
+	                        element = theFields.next();
+	                        if (element instanceof IField) {
+								javaField = (IField) element;
+								IType type = javaField.getDeclaringType();
+								typeName = createQualifiedTypeName(type);
+								fieldName = javaField.getElementName();
+								int f = javaField.getFlags();
+								boolean fin = Flags.isFinal(f);
+								allowed = !(fin) & !(Flags.isStatic(f) & fin);
+							} else if (element instanceof IJavaFieldVariable) {
+								IJavaFieldVariable var = (IJavaFieldVariable) element;
+								typeName = var.getDeclaringType().getName();
+								fieldName = var.getName();
+								boolean fin = var.isFinal();
+								allowed = !(fin) & !(var.isStatic() & fin);
+							}
+	                        breakpoint = getWatchpoint(typeName, fieldName);
+	                        if (breakpoint == null) {
+	                        	if(!allowed) {
+	                        		toggleLineBreakpoints(part, finalSelection);
+	                        		return Status.OK_STATUS;
+	                        	}
+	                        	int start = -1;
+	                            int end = -1;
+	                            attributes = new HashMap(10);
+	                            if (javaField == null) {
+	                            	resource = ResourcesPlugin.getWorkspace().getRoot();
+	                            } else {
+	                                IType type = javaField.getDeclaringType();
+	                                ISourceRange range = javaField.getNameRange();
+	                                if (range != null) {
+	                                    start = range.getOffset();
+	                                    end = start + range.getLength();
+	                                }
+	                                BreakpointUtils.addJavaBreakpointAttributes(attributes, javaField);
+	                                resource = BreakpointUtils.getBreakpointResource(type);
+	                            }
+	                        	JDIDebugModel.createWatchpoint(resource, typeName, fieldName, -1, start, end, 0, true, attributes);
+	                        } else {
+	                            DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(breakpoint, true);
+	                        }
+	                    }
+                    }
+                    else {
+                    	report(ActionMessages.ToggleBreakpointAdapter_2, part);
+                    	return Status.OK_STATUS;
+                    }
+                } catch (CoreException e) {return e.getStatus();}
+                return Status.OK_STATUS;
+            }
+        };
+        job.setSystem(true);
+        job.schedule();
+    }
+    
+    /**
+     * Returns any existing watchpoint for the given field, or <code>null</code> if none.
+     * 
+     * @param typeName fully qualified type name on which watchpoint may exist
+     * @param fieldName field name
+     * @return any existing watchpoint for the given field, or <code>null</code> if none
+     * @throws CoreException
+     */
+    private IJavaWatchpoint getWatchpoint(String typeName, String fieldName) throws CoreException {
+        IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
+        IBreakpoint[] breakpoints = breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
+        for (int i = 0; i < breakpoints.length; i++) {
+            IBreakpoint breakpoint = breakpoints[i];
+            if (breakpoint instanceof IJavaWatchpoint) {
+                IJavaWatchpoint watchpoint = (IJavaWatchpoint) breakpoint;
+                if (typeName.equals(watchpoint.getTypeName()) && fieldName.equals(watchpoint.getFieldName())) {
+                    return watchpoint;
+                }
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Returns the resolved signature of the given method
+     * @param method method to resolve
+     * @return the resolved method signature or <code>null</code> if none
+     * @throws JavaModelException
+     * @since 3.4
+     */
+    public static String resolveMethodSignature(IMethod method) throws JavaModelException {
+    	String signature = method.getSignature();
+        String[] parameterTypes = Signature.getParameterTypes(signature);
+        int length = parameterTypes.length;
+        String[] resolvedParameterTypes = new String[length];
+        for (int i = 0; i < length; i++) {
+            resolvedParameterTypes[i] = resolveTypeSignature(method, parameterTypes[i]);
+            if (resolvedParameterTypes[i] == null) {
+                return null;
+            }
+        }
+        String resolvedReturnType = resolveTypeSignature(method, Signature.getReturnType(signature));
+        if (resolvedReturnType == null) {
+            return null;
+        }
+        return Signature.createMethodSignature(resolvedParameterTypes, resolvedReturnType);
+    }    
+
+    /**
+     * Returns the resolved type signature for the given signature in the given
+     * method, or <code>null</code> if unable to resolve.
+     * 
+     * @param method method containing the type signature
+     * @param typeSignature the type signature to resolve
+     * @return the resolved type signature
+     * @throws JavaModelException
+     */
+    private static String resolveTypeSignature(IMethod method, String typeSignature) throws JavaModelException {
+        int count = Signature.getArrayCount(typeSignature);
+        String elementTypeSignature = Signature.getElementType(typeSignature);
+        if (elementTypeSignature.length() == 1) {
+            // no need to resolve primitive types
+            return typeSignature;
+        }
+        String elementTypeName = Signature.toString(elementTypeSignature);
+        IType type = method.getDeclaringType();
+        String[][] resolvedElementTypeNames = type.resolveType(elementTypeName);
+        if (resolvedElementTypeNames == null || resolvedElementTypeNames.length != 1) {
+        	// check if type parameter
+        	ITypeParameter typeParameter = method.getTypeParameter(elementTypeName);
+        	if (!typeParameter.exists()) {
+        		typeParameter = type.getTypeParameter(elementTypeName);
+        	}
+        	if (typeParameter.exists()) {
+				String[] bounds = typeParameter.getBounds();
+				if (bounds.length == 0) {
+					return "Ljava/lang/Object;"; //$NON-NLS-1$
+				} else {
+					String bound = Signature.createTypeSignature(bounds[0], false);
+					return resolveTypeSignature(method, bound);
+				}
+    		}
+            // the type name cannot be resolved
+            return null;
+        }
+
+        String[] types = resolvedElementTypeNames[0];
+        types[1] = types[1].replace('.', '$');
+        
+        String resolvedElementTypeName = Signature.toQualifiedName(types);
+        String resolvedElementTypeSignature = EMPTY_STRING;
+        if(types[0].equals(EMPTY_STRING)) {
+        	resolvedElementTypeName = resolvedElementTypeName.substring(1);
+        	resolvedElementTypeSignature = Signature.createTypeSignature(resolvedElementTypeName, true);
+        }
+        else {
+        	resolvedElementTypeSignature = Signature.createTypeSignature(resolvedElementTypeName, true).replace('.', '/');
+        }
+
+        return Signature.createArraySignature(resolvedElementTypeSignature, count);
+    }
+
+    /**
+     * Returns the resource associated with the specified editor part
+     * @param editor the currently active editor part
+     * @return the corresponding <code>IResource</code> from the editor part
+     */
+    protected static IResource getResource(IEditorPart editor) {
+        IEditorInput editorInput = editor.getEditorInput();
+        IResource resource = (IResource) editorInput.getAdapter(IFile.class);
+        if (resource == null) {
+            resource = ResourcesPlugin.getWorkspace().getRoot();
+        }
+        return resource;
+    }
+
+    /**
+     * Returns a handle to the specified method or <code>null</code> if none.
+     * 
+     * @param editorPart
+     *            the editor containing the method
+     * @param typeName
+     * @param methodName
+     * @param signature
+     * @return handle or <code>null</code>
+     */
+    protected IMethod getMethodHandle(IEditorPart editorPart, String typeName, String methodName, String signature) throws CoreException {
+        IJavaElement element = (IJavaElement) editorPart.getEditorInput().getAdapter(IJavaElement.class);
+        IType type = null;
+        if (element instanceof ICompilationUnit) {
+            IType[] types = ((ICompilationUnit) element).getAllTypes();
+            for (int i = 0; i < types.length; i++) {
+                if (types[i].getFullyQualifiedName().equals(typeName)) {
+                    type = types[i];
+                    break;
+                }
+            }
+        } else if (element instanceof IClassFile) {
+            type = ((IClassFile) element).getType();
+        }
+        if (type != null) {
+            String[] sigs = Signature.getParameterTypes(signature);
+            return type.getMethod(methodName, sigs);
+        }
+        return null;
+    }
+
+    /**
+     * Returns the <code>IJavaBreakpoint</code> from the specified <code>IMember</code>
+     * @param element the element to get the breakpoint from
+     * @return the current breakpoint from the element or <code>null</code>
+     */
+    protected IJavaBreakpoint getMethodBreakpoint(IMember element) {
+        IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
+        IBreakpoint[] breakpoints = breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
+        if (element instanceof IMethod) {
+            IMethod method = (IMethod) element;
+            for (int i = 0; i < breakpoints.length; i++) {
+                IBreakpoint breakpoint = breakpoints[i];
+                if (breakpoint instanceof IJavaMethodBreakpoint) {
+                    IJavaMethodBreakpoint methodBreakpoint = (IJavaMethodBreakpoint) breakpoint;
+                    IMember container = null;
+                    try {
+                        container = BreakpointUtils.getMember(methodBreakpoint);
+                    } catch (CoreException e) {
+                        JDIDebugUIPlugin.log(e);
+                        return null;
+                    }
+                    if (container == null) {
+                        try {
+                            if (method.getDeclaringType().getFullyQualifiedName().equals(methodBreakpoint.getTypeName()) && 
+                            		method.getElementName().equals(methodBreakpoint.getMethodName()) && 
+                            		methodBreakpoint.getMethodSignature().equals(resolveMethodSignature(method))) {
+                                return methodBreakpoint;
+                            }
+                        } catch (CoreException e) {
+                            JDIDebugUIPlugin.log(e);
+                        }
+                    } else {
+                        if (container instanceof IMethod) {
+                            if (method.getDeclaringType().getFullyQualifiedName().equals(container.getDeclaringType().getFullyQualifiedName())) {
+                                if (method.isSimilar((IMethod) container)) {
+                                    return methodBreakpoint;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the compilation unit from the editor
+     * @param editor the editor to get the compilation unit from
+     * @return the compilation unit or <code>null</code>
+     */
+    protected CompilationUnit parseCompilationUnit(ITextEditor editor) {
+        ITypeRoot root = getTypeRoot(editor.getEditorInput());
+        if(root != null) {
+	        ASTParser parser = ASTParser.newParser(AST.JLS3);
+	        parser.setSource(root);
+	        return (CompilationUnit) parser.createAST(null);
+        }
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
+    	if (isRemote(part, selection)) {
+    		return false;
+    	}
+        if (selection instanceof IStructuredSelection) {
+            IStructuredSelection ss = (IStructuredSelection) selection;
+            return isFields(ss);
+        }
+        return (selection instanceof ITextSelection) && isField((ITextSelection) selection, part);
+    }
+    
+    /**
+     * Returns a selection of the member in the given text selection, or the
+     * original selection if none.
+     * 
+     * @param part
+     * @param selection
+     * @return a structured selection of the member in the given text selection,
+     *         or the original selection if none
+     * @exception CoreException
+     *                if an exception occurs
+     */
+    protected ISelection translateToMembers(IWorkbenchPart part, ISelection selection) throws CoreException {
+    	ITextEditor textEditor = getTextEditor(part);
+        if (textEditor != null && selection instanceof ITextSelection) {
+            ITextSelection textSelection = (ITextSelection) selection;
+            IEditorInput editorInput = textEditor.getEditorInput();
+            IDocumentProvider documentProvider = textEditor.getDocumentProvider();
+            if (documentProvider == null) {
+                throw new CoreException(Status.CANCEL_STATUS);
+            }
+            IDocument document = documentProvider.getDocument(editorInput);
+            int offset = textSelection.getOffset();
+            if (document != null) {
+                try {
+                    IRegion region = document.getLineInformationOfOffset(offset);
+                    int end = region.getOffset() + region.getLength();
+                    while (Character.isWhitespace(document.getChar(offset)) && offset < end) {
+                        offset++;
+                    }
+                } catch (BadLocationException e) {}
+            }
+            IMember m = null;
+            ITypeRoot root = getTypeRoot(editorInput);
+            if(root instanceof ICompilationUnit) {
+                ICompilationUnit unit = (ICompilationUnit) root;
+                synchronized (unit) {
+                    unit.reconcile(ICompilationUnit.NO_AST , false, null, null);
+                }
+            }
+            if(root != null){
+                IJavaElement e = root.getElementAt(offset);
+                if (e instanceof IMember) {
+                    m = (IMember) e;
+                }
+            }
+            if (m != null) {
+                return new StructuredSelection(m);
+            }
+        }
+        return selection;
+    }
+
+    /**
+     * Returns the {@link ITypeRoot} for the given {@link IEditorInput}
+     * @param input
+     * @return the type root or <code>null</code> if one cannot be derived
+	 * @since 3.4
+     */
+    private ITypeRoot getTypeRoot(IEditorInput input) {
+    	ITypeRoot root = (ITypeRoot) input.getAdapter(IClassFile.class);
+    	if(root == null) {
+    		 IWorkingCopyManager manager = JavaUI.getWorkingCopyManager();
+             root = manager.getWorkingCopy(input);
+    	}
+    	if(root == null) {
+    		root = DebugWorkingCopyManager.getWorkingCopy(input, false);
+    	}
+    	return root;
+    }
+    
+    /**
+     * Return the associated IField (Java model) for the given
+     * IJavaFieldVariable (JDI model)
+     */
+    private IField getField(IJavaFieldVariable variable) throws CoreException {
+        String varName = null;
+        try {
+            varName = variable.getName();
+        } catch (DebugException x) {
+            JDIDebugUIPlugin.log(x);
+            return null;
+        }
+        IField field;
+        IJavaType declaringType = variable.getDeclaringType(); 
+        IType type = JavaDebugUtils.resolveType(declaringType);
+        if (type != null) {
+            field = type.getField(varName);
+            if (field.exists()) {
+                return field;
+            }
+        }
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+    	ISelection sel = translateToMembers(part, selection);
+    	if(sel instanceof IStructuredSelection) {
+    		IMember member = (IMember) ((IStructuredSelection)sel).getFirstElement();
+    		int mtype = member.getElementType();
+    		if(mtype == IJavaElement.FIELD || mtype == IJavaElement.METHOD) {
+    			// remove line breakpoint if present first
+    	    	if (selection instanceof ITextSelection) {
+    				ITextSelection ts = (ITextSelection) selection;
+    				IType declaringType = member.getDeclaringType();
+    				IResource resource = BreakpointUtils.getBreakpointResource(declaringType);
+					IJavaLineBreakpoint breakpoint = JDIDebugModel.lineBreakpointExists(resource, createQualifiedTypeName(declaringType), ts.getStartLine() + 1);
+    				if (breakpoint != null) {
+    					breakpoint.delete();
+    					return;
+    				}
+    				CompilationUnit unit = parseCompilationUnit(getTextEditor(part));
+//ObjectTeams: (visibility) OTValidBreakpointLocationLocator instead of ValidBreakpointLocationLocator
+        			OTValidBreakpointLocationLocator loc = new OTValidBreakpointLocationLocator(unit, ts.getStartLine()+1, true, true);
+        			unit.accept(loc);
+        			if(loc.getLocationType() == OTValidBreakpointLocationLocator.LOCATION_METHOD) {
+        				toggleMethodBreakpoints(part, sel);
+        			}
+        			else if(loc.getLocationType() == OTValidBreakpointLocationLocator.LOCATION_FIELD) {
+        				toggleWatchpoints(part, ts);
+        			}
+        			else if(loc.getLocationType() == OTValidBreakpointLocationLocator.LOCATION_LINE) {
+        				toggleLineBreakpoints(part, ts);
+        			}
+// carp}
+    			} 
+    		}
+    		else if(member.getElementType() == IJavaElement.TYPE) {
+    			toggleClassBreakpoints(part, sel);
+    		}
+    		else {
+    			//fall back to old behavior, always create a line breakpoint
+    			toggleLineBreakpoints(part, selection, true);
+    		}
+    	}
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
+    	if (isRemote(part, selection)) {
+    		return false;
+    	}    	
+        return canToggleLineBreakpoints(part, selection);
+    }
+}
+
+//ike}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTValidBreakpointLocationLocator.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTValidBreakpointLocationLocator.java
new file mode 100644
index 0000000..dc88fc7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/OTValidBreakpointLocationLocator.java
@@ -0,0 +1,1153 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTValidBreakpointLocationLocator.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Fraunhofer FIRST - extended API and implementation
+ *     Technical University Berlin - extended API and implementation
+ *******************************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.*;
+import org.eclipse.jdt.core.dom.PrefixExpression.Operator;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+
+/**
+ * Compute a valid location where to put a breakpoint from an JDOM CompilationUnit.
+ * The result is the first valid location with a line number greater or equals than the given position.
+ *
+ * The Visitor visits now also OT-nodes like Callout-/CallinMappingDeclaration and decides wheather a breakpoint
+ * is allowed in this node or not.
+*
+ * @author ike
+ * $Id: OTValidBreakpointLocationLocator.java 23432 2010-02-03 23:13:42Z stephan $
+ */
+//{OT_COPY_PASTE from org.eclipse.jdt.internal.debug.ui.action.ValidBreakpointLocationLocator
+// due to private visibility of visit(ASTNode, boolean) (added visitor-methods can't call it)
+// -> could easily be ported to OT, together with OTBreakpointLocationVerifierJob
+public class OTValidBreakpointLocationLocator extends ASTVisitor {
+
+	public static final int LOCATION_NOT_FOUND= 0;
+	public static final int LOCATION_LINE= 1;
+	public static final int LOCATION_METHOD= 2;
+	public static final int LOCATION_FIELD= 3;
+	
+	private CompilationUnit fCompilationUnit;
+	private int fLineNumber;
+	private boolean fBindingsResolved;
+	private boolean fNeedBindings = false;
+	private boolean fBestMatch;
+
+	private int fLocationType;
+	private boolean fLocationFound;
+	private String fTypeName;
+	private int fLineLocation;
+	private int fMemberOffset;
+    private List fLabels;
+
+	/**
+	 * @param compilationUnit the JDOM CompilationUnit of the source code.
+	 * @param lineNumber the line number in the source code where to put the breakpoint.
+	 * @param bestMatch if <code>true</code> look for the best match, otherwise look only for a valid line
+	 */
+	public OTValidBreakpointLocationLocator(CompilationUnit compilationUnit, int lineNumber, boolean bindingsResolved, boolean bestMatch) {
+		fCompilationUnit= compilationUnit;
+		fLineNumber= lineNumber;
+		fBindingsResolved= bindingsResolved;
+		fBestMatch= bestMatch;
+		fLocationFound= false;
+	}
+	
+	/**
+	 * Returns whether binding information would be helpful in validating a breakpoint
+	 * location. If this locator makes a pass of the tree and determines that binding
+	 * information would be helpful but was not available, this method returns
+	 * <code>true</code>.
+	 * 
+	 * @return whether binding information would be helpful in validating a breakpoint location
+	 */
+	public boolean isBindingsRequired() {
+		return fNeedBindings;
+	}
+	
+	/**
+	 * Return the type of the valid location found
+	 * @return one of LOCATION_NOT_FOUND, LOCATION_LINE, LOCATION_METHOD or LOCATION_FIELD
+	 */
+	public int getLocationType() {
+		return fLocationType;
+	}
+	
+	/**
+	 * Return of the type where the valid location is.
+	 */
+	public String getFullyQualifiedTypeName() {
+		return fTypeName;
+	}
+	
+	/**
+	 * Return the line number of the computed valid location, if the location type is LOCATION_LINE.
+	 */
+	public int getLineLocation() {
+		if (fLocationType == LOCATION_LINE) {
+			return fLineLocation;
+		}
+		return -1;
+	}
+	
+	/**
+	 * Return the offset of the member which is the valid location,
+	 * if the location type is LOCATION_METHOD or LOCATION_FIELD.
+	 */
+	public int getMemberOffset() {
+		return fMemberOffset;
+	}
+	
+	/**
+	 * Compute the name of the type which contains this node.
+	 * Result will be the name of the type or the inner type which contains this node, but not of the local or anonymous type.
+	 */
+	static protected String computeTypeName(ASTNode node) {
+//{ObjectTeams: several modifications to cope with role classes (inline and role file):
+
+		// type part:
+		String typeName = null;
+		while (!(node instanceof CompilationUnit)) {
+			if (node instanceof AbstractTypeDeclaration) {
+				String identifier= ((AbstractTypeDeclaration)node).getName().getIdentifier();
+				if (typeName == null) {
+					typeName= identifier;
+					if (   node instanceof RoleTypeDeclaration
+						&& !typeName.startsWith(IOTConstants.OT_DELIM))
+						typeName= IOTConstants.OT_DELIM+typeName;
+				} else {
+					typeName= identifier + '$' + typeName;
+				}
+			} else {
+				typeName= null;
+			}
+			node= node.getParent();
+		}
+		
+		// package part (may be team package):
+		PackageDeclaration packageDecl= ((CompilationUnit)node).getPackage();
+		char sep= '.'; // for regular toplevel types
+		if (typeName.startsWith(IOTConstants.OT_DELIM))
+			sep= '$';  // for role files
+		String packageIdentifier= ""; //$NON-NLS-1$
+		if (packageDecl != null) {
+			Name packageName= packageDecl.getName();
+			while (packageName.isQualifiedName()) {
+				QualifiedName qualifiedName= (QualifiedName) packageName;
+				packageIdentifier= qualifiedName.getName().getIdentifier() + sep + packageIdentifier;
+				sep= '.';
+				packageName= qualifiedName.getQualifier();
+			}
+			packageIdentifier= ((SimpleName)packageName).getIdentifier() + sep + packageIdentifier;
+		}
+
+		return packageIdentifier + typeName;
+// SH}
+	}
+
+	/**
+	 * Return <code>true</code> if this node children may contain a valid location
+	 * for the breakpoint.
+	 * @param node the node.
+	 * @param isCode true indicated that the first line of the given node always
+	 *	contains some executable code, even if split in multiple lines.
+	 */
+	private boolean visit(ASTNode node, boolean isCode) {
+		// if we already found a correct location
+		// no need to check the element inside.
+		if (fLocationFound) {
+			return false;
+		}
+		int startPosition= node.getStartPosition();
+		int endLine= lineNumber(startPosition + node.getLength() - 1);
+		// if the position is not in this part of the code
+		// no need to check the element inside.
+		if (endLine < fLineNumber) {
+			return false;
+		}
+		// if the first line of this node always represents some executable code and the
+		// breakpoint is requested on this line or on a previous line, this is a valid 
+		// location
+		int startLine = lineNumber(startPosition);
+		if (isCode && (fLineNumber <= startLine)) {
+			fLineLocation= startLine;
+			fLocationFound= true;
+			fLocationType= LOCATION_LINE;
+			fTypeName= computeTypeName(node);
+			return false;
+		}
+		return true;
+	}
+	
+	private boolean isReplacedByConstantValue(Expression node) {
+		switch (node.getNodeType()) {
+			// litterals are constant
+			case ASTNode.BOOLEAN_LITERAL:
+			case ASTNode.CHARACTER_LITERAL:
+			case ASTNode.NUMBER_LITERAL:
+			case ASTNode.STRING_LITERAL:
+				return true;
+			case ASTNode.SIMPLE_NAME:
+			case ASTNode.QUALIFIED_NAME:
+				return isReplacedByConstantValue((Name)node);
+			case ASTNode.FIELD_ACCESS:
+				return isReplacedByConstantValue((FieldAccess)node);
+			case ASTNode.SUPER_FIELD_ACCESS:
+				return isReplacedByConstantValue((SuperFieldAccess)node);
+			case ASTNode.INFIX_EXPRESSION:
+				return isReplacedByConstantValue((InfixExpression)node);
+			case ASTNode.PREFIX_EXPRESSION:
+				return isReplacedByConstantValue((PrefixExpression)node);
+			case ASTNode.CAST_EXPRESSION:
+				return isReplacedByConstantValue(((CastExpression)node).getExpression());
+			default:
+				return false;
+		}
+	}
+	
+	private boolean isReplacedByConstantValue(InfixExpression node) {
+		// if all operands are constant value, the expression is replaced by a constant value
+		if (!(isReplacedByConstantValue(node.getLeftOperand()) && isReplacedByConstantValue(node.getRightOperand()))) {
+			return false;
+		}
+		if (node.hasExtendedOperands()) {
+			for (Iterator iter = node.extendedOperands().iterator(); iter.hasNext(); ) {
+				if (!isReplacedByConstantValue((Expression) iter.next())) {
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+	
+	private boolean isReplacedByConstantValue(PrefixExpression node) {
+		// for '-', '+', '~' and '!', if the operand is a constant value,
+		// the expression is replaced by a constant value
+		Operator operator = node.getOperator();
+		if (operator != PrefixExpression.Operator.INCREMENT && operator != PrefixExpression.Operator.DECREMENT) {
+			return isReplacedByConstantValue(node.getOperand());
+		}
+		return false;
+	}
+	
+	private boolean isReplacedByConstantValue(Name node) {
+		if (!fBindingsResolved) {
+			fNeedBindings = true;
+			return false;
+		}
+		// if node is a variable with a constant value (static final field)
+		IBinding binding= node.resolveBinding();
+		if (binding != null && binding.getKind() == IBinding.VARIABLE) {
+			return ((IVariableBinding)binding).getConstantValue() != null;
+		}
+		return false;
+	}
+	
+	private boolean isReplacedByConstantValue(FieldAccess node) {
+		if (!fBindingsResolved) {
+			fNeedBindings = true;
+			return false;
+		}
+		// if the node is 'this.<field>', and the field is static final
+		Expression expression= node.getExpression();
+		IVariableBinding binding= node.resolveFieldBinding();
+		if (binding != null && expression.getNodeType() == ASTNode.THIS_EXPRESSION) {
+			return binding.getConstantValue() != null;
+		}
+		return false;
+	}
+	
+	private boolean isReplacedByConstantValue(SuperFieldAccess node) {
+		if (!fBindingsResolved) {
+			fNeedBindings = true;
+			return false;
+		}
+		// if the field is static final
+		IVariableBinding binding= node.resolveFieldBinding();
+		if (binding != null) {
+			return binding.getConstantValue() != null;
+		}
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.AnnotationTypeDeclaration)
+	 */
+	public boolean visit(AnnotationTypeDeclaration node) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration)
+	 */
+	public boolean visit(AnnotationTypeMemberDeclaration node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.AnonymousClassDeclaration)
+	 */
+	public boolean visit(AnonymousClassDeclaration node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayAccess)
+	 */
+	public boolean visit(ArrayAccess node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayCreation)
+	 */
+	public boolean visit(ArrayCreation node) {
+		return visit(node, node.getInitializer() == null);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayInitializer)
+	 */
+	public boolean visit(ArrayInitializer node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayType)
+	 */
+	public boolean visit(ArrayType node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.AssertStatement)
+	 */
+	public boolean visit(AssertStatement node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.Assignment)
+	 */
+	public boolean visit(Assignment node) {
+		if (visit(node, false)) {
+			// if the left hand side represent a local variable, or a static field
+			// and the breakpoint was requested on a line before the line where
+			// starts the assigment, set the location to be the first executable
+			// instruction of the right hand side, as it will be the first part of
+			// this assigment to be executed
+			Expression leftHandSide= node.getLeftHandSide();
+			if (leftHandSide instanceof Name) {
+				int startLine = lineNumber(node.getStartPosition());
+				if (fLineNumber < startLine) {
+					if (fBindingsResolved) {
+						IVariableBinding binding= (IVariableBinding)((Name)leftHandSide).resolveBinding();
+						if (binding != null && (!binding.isField() || Modifier.isStatic(binding.getModifiers())))  {
+							node.getRightHandSide().accept(this);
+						}
+					} else {
+						fNeedBindings = true;
+					}
+				}
+			}
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.Block)
+	 */
+	public boolean visit(Block node) {
+		if (visit(node, false)) {
+			if (node.statements().isEmpty() && node.getParent().getNodeType() == ASTNode.METHOD_DECLARATION) {
+				// in case of an empty method, set the breakpoint on the last line of the empty block.
+				fLineLocation= lineNumber(node.getStartPosition() + node.getLength() - 1);
+				fLocationFound= true;
+				fLocationType= LOCATION_LINE;
+				fTypeName= computeTypeName(node);
+				return false;
+			}
+			return true;
+		}
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BlockComment)
+	 */
+	public boolean visit(BlockComment node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BooleanLiteral)
+	 */
+	public boolean visit(BooleanLiteral node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BreakStatement)
+	 */
+	public boolean visit(BreakStatement node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CastExpression)
+	 */
+	public boolean visit(CastExpression node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CatchClause)
+	 */
+	public boolean visit(CatchClause node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CharacterLiteral)
+	 */
+	public boolean visit(CharacterLiteral node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ClassInstanceCreation)
+	 */
+	public boolean visit(ClassInstanceCreation node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CompilationUnit)
+	 */
+	public boolean visit(CompilationUnit node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ConditionalExpression)
+	 */
+	public boolean visit(ConditionalExpression node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ConstructorInvocation)
+	 */
+	public boolean visit(ConstructorInvocation node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ContinueStatement)
+	 */
+	public boolean visit(ContinueStatement node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.DoStatement)
+	 */
+	public boolean visit(DoStatement node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EmptyStatement)
+	 */
+	public boolean visit(EmptyStatement node) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EnhancedForStatement)
+	 */
+	public boolean visit(EnhancedForStatement node) {
+		if (visit(node, false)) {
+			node.getExpression().accept(this);
+			node.getBody().accept(this);
+		}
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EnumConstantDeclaration)
+	 */
+	public boolean visit(EnumConstantDeclaration node) {
+		if (visit(node, false)) {
+			List arguments= node.arguments();
+			for (Iterator iter= arguments.iterator(); iter.hasNext();) {
+				((Expression)iter.next()).accept(this);
+			}
+			AnonymousClassDeclaration decl= node.getAnonymousClassDeclaration();
+			if (decl != null) {
+				decl.accept(this);
+			}
+		}
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EnumDeclaration)
+	 */
+	public boolean visit(EnumDeclaration node) {
+		if (visit(node, false)) {
+			List enumConstants= node.enumConstants();
+			for (Iterator iter = enumConstants.iterator(); iter.hasNext();) {
+				((EnumConstantDeclaration) iter.next()).accept(this);
+			}
+			List bodyDeclaration= node.bodyDeclarations();
+			for (Iterator iter= bodyDeclaration.iterator(); iter.hasNext();) {
+				((BodyDeclaration)iter.next()).accept(this);
+			}
+		}
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ExpressionStatement)
+	 */
+	public boolean visit(ExpressionStatement node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.FieldAccess)
+	 */
+	public boolean visit(FieldAccess node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.FieldDeclaration)
+	 */
+	public boolean visit(FieldDeclaration node) {
+		if (visit(node, false)) {
+			if (fBestMatch) {
+				// check if the line contains a single field declaration.
+				List fragments = node.fragments();
+				if (fragments.size() == 1) {
+					int offset= ((VariableDeclarationFragment)fragments.get(0)).getName().getStartPosition();
+					// check if the breakpoint is to be set on the line which contains the name of the field
+					if (lineNumber(offset) == fLineNumber) {
+						fMemberOffset= offset;
+						fLocationType= LOCATION_FIELD;
+						fLocationFound= true;
+						return false;
+					}
+				}
+			}
+			// visit only the variable declaration fragments, no the variable names.
+			List fragments= node.fragments();
+			for (Iterator iter= fragments.iterator(); iter.hasNext();) {
+				((VariableDeclarationFragment)iter.next()).accept(this);
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ForStatement)
+	 */
+	public boolean visit(ForStatement node) {
+		// in case on a "for(;;)", the breakpoint can be set on the first token of the node.
+		return visit(node, node.initializers().isEmpty() && node.getExpression() == null && node.updaters().isEmpty());
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.IfStatement)
+	 */
+	public boolean visit(IfStatement node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ImportDeclaration)
+	 */
+	public boolean visit(ImportDeclaration node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.InfixExpression)
+	 */
+	public boolean visit(InfixExpression node) {
+		// if the breakpoint is to be set on a constant operand, the breakpoint needs to be
+		// set on the first constant operand after the previous non-constant operand
+		// (or the beginning of the expression, if there is no non-constant operand before).
+		// ex:   foo() +    // previous non-constant operand
+		//       1 +        // breakpoint set here
+		//       2          // breakpoint asked to be set here
+		if (visit(node, false)) {
+			Expression leftOperand= node.getLeftOperand();
+			Expression firstConstant= null;
+			if (visit(leftOperand, false)) {
+				leftOperand.accept(this);
+				return false;
+			} 
+			if (isReplacedByConstantValue(leftOperand)) {
+				firstConstant= leftOperand;
+			}
+			Expression rightOperand= node.getRightOperand();
+			if (visit(rightOperand, false)) {
+				if (firstConstant == null || !isReplacedByConstantValue(rightOperand)) {
+					rightOperand.accept(this);
+					return false;
+				}
+			} else {
+				if (isReplacedByConstantValue(rightOperand)) {
+					if (firstConstant == null) {
+						firstConstant= rightOperand;
+					}
+				} else {
+					firstConstant= null;
+				}
+				List extendedOperands= node.extendedOperands();
+				for (Iterator iter= extendedOperands.iterator(); iter.hasNext();) {
+					Expression operand= (Expression) iter.next();
+					if (visit(operand, false)) {
+						if (firstConstant == null || !isReplacedByConstantValue(operand)) {
+							operand.accept(this);
+							return false;
+						}
+						break;
+					} 
+					if (isReplacedByConstantValue(operand)) {
+						if (firstConstant == null) {
+							firstConstant= operand;
+						}
+					} else {
+						firstConstant= null;
+					}
+					
+				}
+			}
+			fLineLocation= lineNumber(firstConstant.getStartPosition());
+			fLocationFound= true;
+			fLocationType= LOCATION_LINE;
+			fTypeName= computeTypeName(firstConstant);
+		}
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.Initializer)
+	 */
+	public boolean visit(Initializer node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.InstanceofExpression)
+	 */
+	public boolean visit(InstanceofExpression node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.Javadoc)
+	 */
+	public boolean visit(Javadoc node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.LabeledStatement)
+	 */
+	public boolean visit(LabeledStatement node) {
+        nestLabel(node.getLabel().getFullyQualifiedName());
+		return visit(node, false);
+	}
+    
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#endVisit(org.eclipse.jdt.core.dom.LabeledStatement)
+	 */
+	public void endVisit(LabeledStatement node) {
+        popLabel();
+        super.endVisit(node);
+    }
+    
+    private String getLabel() {
+        if (fLabels == null || fLabels.isEmpty()) {
+            return null;
+        }
+        return (String) fLabels.get(fLabels.size() - 1);
+    }
+    
+    private void nestLabel(String label) {
+        if (fLabels == null) {
+            fLabels = new ArrayList();
+        }
+        fLabels.add(label);
+    }
+    
+    private void popLabel() {
+        if (fLabels == null || fLabels.isEmpty()) {
+            return;
+        }
+        fLabels.remove(fLabels.size() - 1);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.LineComment)
+	 */
+	public boolean visit(LineComment node) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MarkerAnnotation)
+	 */
+	public boolean visit(MarkerAnnotation node) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MemberRef)
+	 */
+	public boolean visit(MemberRef node) {
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MemberValuePair)
+	 */
+	public boolean visit(MemberValuePair node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodDeclaration)
+	 */
+	public boolean visit(MethodDeclaration node) {
+		if (visit(node, false)) {
+			if (fBestMatch) {
+				// check if we are on the line which contains the method name
+				int nameOffset= node.getName().getStartPosition();
+				if (lineNumber(nameOffset) == fLineNumber) {
+					fMemberOffset= nameOffset;
+					fLocationType= LOCATION_METHOD;
+					fLocationFound= true;
+					return false;
+				}
+			}
+			// visit only the body
+			Block body = node.getBody();
+			if (body != null) { // body is null for abstract methods
+				body.accept(this);
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodInvocation)
+	 */
+	public boolean visit(MethodInvocation node) {
+		return visit(node, true);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodRef)
+	 */
+	public boolean visit(MethodRef node) {
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodRefParameter)
+	 */
+	public boolean visit(MethodRefParameter node) {
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.Modifier)
+	 */
+	public boolean visit(Modifier node) {
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.NormalAnnotation)
+	 */
+	public boolean visit(NormalAnnotation node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.NullLiteral)
+	 */
+	public boolean visit(NullLiteral node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.NumberLiteral)
+	 */
+	public boolean visit(NumberLiteral node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.PackageDeclaration)
+	 */
+	public boolean visit(PackageDeclaration node) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ParameterizedType)
+	 */
+	public boolean visit(ParameterizedType node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ParenthesizedExpression)
+	 */
+	public boolean visit(ParenthesizedExpression node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.PostfixExpression)
+	 */
+	public boolean visit(PostfixExpression node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.PrefixExpression)
+	 */
+	public boolean visit(PrefixExpression node) {
+		if (visit(node, false)) {
+			if (isReplacedByConstantValue(node)) {
+				fLineLocation= lineNumber(node.getStartPosition());
+				fLocationFound= true;
+				fLocationType= LOCATION_LINE;
+				fTypeName= computeTypeName(node);
+				return false;
+			}
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.PrimitiveType)
+	 */
+	public boolean visit(PrimitiveType node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.QualifiedName)
+	 */
+	public boolean visit(QualifiedName node) {
+		visit(node, true);
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.QualifiedType)
+	 */
+	public boolean visit(QualifiedType node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ReturnStatement)
+	 */
+	public boolean visit(ReturnStatement node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SimpleName)
+	 */
+	public boolean visit(SimpleName node) {
+        // the name is only code if its not the current label (if any)
+		return visit(node, !node.getFullyQualifiedName().equals(getLabel()));
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SimpleType)
+	 */
+	public boolean visit(SimpleType node) {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SingleMemberAnnotation)
+	 */
+	public boolean visit(SingleMemberAnnotation node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SingleVariableDeclaration)
+	 */
+	public boolean visit(SingleVariableDeclaration node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.StringLiteral)
+	 */
+	public boolean visit(StringLiteral node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SuperConstructorInvocation)
+	 */
+	public boolean visit(SuperConstructorInvocation node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SuperFieldAccess)
+	 */
+	public boolean visit(SuperFieldAccess node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SuperMethodInvocation)
+	 */
+	public boolean visit(SuperMethodInvocation node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SwitchCase)
+	 */
+	public boolean visit(SwitchCase node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SwitchStatement)
+	 */
+	public boolean visit(SwitchStatement node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SynchronizedStatement)
+	 */
+	public boolean visit(SynchronizedStatement node) {
+		return visit(node, false);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TagElement)
+	 */
+	public boolean visit(TagElement node) {
+		return false;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TextElement)
+	 */
+	public boolean visit(TextElement node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ThisExpression)
+	 */
+	public boolean visit(ThisExpression node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ThrowStatement)
+	 */
+	public boolean visit(ThrowStatement node) {
+		return visit(node, true);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TryStatement)
+	 */
+	public boolean visit(TryStatement node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclaration)
+	 */
+	public boolean visit(TypeDeclaration node) {
+		if (visit(node, false)) {
+			// visit only the elements of the type declaration
+			List bodyDeclaration= node.bodyDeclarations();
+			for (Iterator iter= bodyDeclaration.iterator(); iter.hasNext();) {
+				((BodyDeclaration)iter.next()).accept(this);
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclarationStatement)
+	 */
+	public boolean visit(TypeDeclarationStatement node) {
+		return visit(node, false);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeParameter)
+	 */
+	public boolean visit(TypeParameter node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeLiteral)
+	 */
+	public boolean visit(TypeLiteral node) {
+		return false;
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.VariableDeclarationExpression)
+	 */
+	public boolean visit(VariableDeclarationExpression node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.VariableDeclarationFragment)
+	 */
+	public boolean visit(VariableDeclarationFragment node) {
+		Expression initializer = node.getInitializer();
+		if (visit(node, false) && initializer != null) {
+			int startLine = lineNumber(node.getName().getStartPosition());
+            
+			if (fLineNumber == startLine) {
+				fLineLocation= startLine;
+				fLocationFound= true;
+				fLocationType= LOCATION_LINE;
+				fTypeName= computeTypeName(node);
+				return false;
+			}
+			initializer.accept(this);
+		}
+		return false;
+	}
+
+    private int lineNumber(int offset) {
+        int lineNumber = fCompilationUnit.getLineNumber(offset);
+        return lineNumber < 1 ? 1 : lineNumber;
+    }
+        
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.WildcardType)
+	 */
+	public boolean visit(WildcardType node) {
+		return false;
+	}
+	
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.VariableDeclarationStatement)
+	 */
+	public boolean visit(VariableDeclarationStatement node) {
+		return visit(node, false);
+	}
+
+	/**
+	 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.WhileStatement)
+	 */
+	public boolean visit(WhileStatement node) {
+		return visit(node, false);
+	}
+
+//{ObjectTeams: visit also ot-specific nodes or skip some
+
+	public boolean visit(GuardPredicateDeclaration node) {
+		// visit only the expression (don't want a method-entry breakpoint but stop directly at the expression).
+		ASTNode expression = node.getExpression();
+		expression.accept(this);
+		return false;
+	}
+	
+    public boolean visit(CallinMappingDeclaration node)
+    {
+        return visit(node, false);
+    }
+    
+    public boolean visit(CalloutMappingDeclaration node)
+    {
+        return visit(node, false);
+    }
+    
+    public boolean visit(FieldAccessSpec node)
+    {
+        return visit(node, false);
+    }
+    
+    public boolean visit(LiftingType node)
+    {
+        return false;
+    }
+    
+    public boolean visit(TypeAnchor node)
+    {
+        return false;
+    }
+    
+    public boolean visit(MethodSpec node)
+    {
+        return visit(node, false);
+    }
+    
+    public boolean visit(ParameterMapping node)
+    {
+        return false;
+    }
+
+    public boolean visit(RoleTypeDeclaration node)
+    {
+        if (visit(node, false)) {
+        	// guards first: appear before body declarations:
+        	GuardPredicateDeclaration guard = node.getGuardPredicate();
+        	if (guard != null)
+        		guard.accept(this);
+            // visit only the elements of the type declaration
+            List bodyDeclaration= node.bodyDeclarations();
+            for (Iterator iter= bodyDeclaration.iterator(); iter.hasNext();) {
+                ((BodyDeclaration)iter.next()).accept(this);
+            }
+        }
+        return false;
+    }
+    
+    public boolean visit(WithinStatement node)
+    {
+        return visit(node, false);
+    }
+//ike}
+}
+//ike}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java
new file mode 100644
index 0000000..f91a469
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java
@@ -0,0 +1,89 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: SortTeamAction.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.objectteams.otdt.debug.IOTDTDebugPreferenceConstants;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugImages;
+import org.eclipse.objectteams.otdt.debug.ui.views.TeamView;
+import org.eclipse.objectteams.otdt.debug.ui.views.TeamViewMessages;
+
+/**
+ * @author ike
+ * This Action sorts the teams in TeamMonitor.
+ * 
+ * $Id: SortTeamAction.java 23432 2010-02-03 23:13:42Z stephan $
+ */
+public class SortTeamAction extends Action
+{
+	private TeamView _teamView;
+	private String _sortMode; 
+
+	public SortTeamAction(TeamView teamView, String sortMode)
+	{
+		super("", AS_RADIO_BUTTON); //$NON-NLS-1$
+
+		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_TIME)
+		{
+			setText(TeamViewMessages.SortTeamByActivation_0);
+			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_ACTIVATION_TIME));
+		}
+
+		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER)
+		{
+			setText(TeamViewMessages.SortTeamByActivation_1);
+			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_ACTIVATION_ORDER));
+		}
+
+		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION)
+		{
+			setText(TeamViewMessages.SortTeamByInstantiation_0);
+			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_INSTANTIATION));
+		}
+
+		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_NAME)
+		{
+			setText(TeamViewMessages.SortTeamByName_0);  
+			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_NAME));  
+		}
+
+		_teamView = teamView;
+		_sortMode = sortMode;
+		setChecked(sortMode == _teamView.getDefaultSortMode());
+	}
+
+	public void run()
+	{
+		if (isChecked())
+		{
+			_teamView.setSortMode(getSortMode());
+			OTDebugElementsContainer container = (OTDebugElementsContainer)_teamView.getViewer().getInput();
+			container.setSortMode(getSortMode());
+			_teamView.getViewer().setInput(container);
+		}
+	}
+
+	private String getSortMode()
+	{
+		return _sortMode;
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/UpdateTeamViewAction.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/UpdateTeamViewAction.java
new file mode 100644
index 0000000..0eb143c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/UpdateTeamViewAction.java
@@ -0,0 +1,51 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: UpdateTeamViewAction.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.actions;

+

+import org.eclipse.jface.action.Action;

+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugImages;
+import org.eclipse.objectteams.otdt.debug.ui.views.TeamView;
+

+public class UpdateTeamViewAction extends Action

+{

+	private TeamView _teamView;

+

+	public UpdateTeamViewAction(TeamView teamView)

+	{

+		super("", AS_CHECK_BOX);

+		setToolTipText("Permanently update Team Monitor");

+		setDescription("Shows teams and their activation state while the application is running.");

+		setImageDescriptor(OTDebugImages.get(OTDebugImages.UPDATE_TEAM_VIEW_ACTION));

+		_teamView = teamView;

+	}

+	

+	@Override

+	public void run()

+	{

+		_teamView.setUpdatePermanently(isChecked());

+		OTDebugElementsContainer container = (OTDebugElementsContainer)_teamView.getViewer().getInput();

+		if(isChecked())

+		{

+			_teamView.getViewer().setInput(container);

+		}

+	}

+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDebugElementsContainerContentProvider.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDebugElementsContainerContentProvider.java
new file mode 100644
index 0000000..827ca92
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDebugElementsContainerContentProvider.java
@@ -0,0 +1,78 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugElementsContainerContentProvider.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.TeamInstance;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+
+/**
+ * Provide top level nodes for the TeamView:
+ * + team instances from an OTDebugElementsContainer
+ * 
+ * @author stephan
+ * @since 1.1.2
+ */
+public class OTDebugElementsContainerContentProvider extends ElementContentProvider
+{
+
+	@Override
+	protected int getChildCount(Object               element, 
+								IPresentationContext context, 
+								IViewerUpdate        monitor) 
+			throws CoreException 
+	{
+		OTDebugElementsContainer container = (OTDebugElementsContainer) element;
+		return container.getChildCount();
+	}
+
+	@Override
+	protected Object[] getChildren(Object               parent, 
+			                       int                  index, 
+			                       int                  length,
+								   IPresentationContext context, 
+								   IViewerUpdate        monitor)
+			throws CoreException 
+	{
+        OTDebugElementsContainer container = (OTDebugElementsContainer) parent;
+        if(container.hasTeamInstances())
+        {
+        	ArrayList<TeamInstance> teamInstances = container.getTeamInstances();
+        	Object[] result= new Object[length];
+        	for (int i=0; i<length; i++)
+        		result[i]= teamInstances.get(index+i);
+        	return result;
+        }
+		return null;
+
+	}
+
+	@Override
+	protected boolean supportsContextId(String id) {
+		return id.equals(OTDebugUIPlugin.TEAM_VIEW_ID);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDebugElementsContainerLabelProvider.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDebugElementsContainerLabelProvider.java
new file mode 100644
index 0000000..c9b63ed
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDebugElementsContainerLabelProvider.java
@@ -0,0 +1,40 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugElementsContainerLabelProvider.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jface.viewers.TreePath;
+
+/** Label for the root node of the TeamView (which does not have a label). */
+public class OTDebugElementsContainerLabelProvider extends ElementLabelProvider {
+
+	@Override
+	protected String getLabel(TreePath             elementPath, 
+							  IPresentationContext presentationContext, 
+							  String               columnId)
+			throws CoreException 
+	{
+		return "never-seen-OTDebugLabel"; //$NON-NLS-1$
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultModelProxyFactory.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultModelProxyFactory.java
new file mode 100644
index 0000000..9e825ab
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultModelProxyFactory.java
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDefaultModelProxyFactory.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.update.DefaultModelProxyFactory;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+
+/**
+ * Install OTDefaultVariableViewModelProxy.
+ * 
+ * @author stephan
+ * @since 1.1.2
+ */
+public class OTDefaultModelProxyFactory extends DefaultModelProxyFactory 
+{
+	@Override
+	public IModelProxy createModelProxy(Object element, IPresentationContext context) 
+	{
+		String id= context.getId();
+		if (OTDebugUIPlugin.TEAM_VIEW_ID.equals(id)) {
+			if (element instanceof OTDebugElementsContainer)
+				return new OTDefaultVariableViewModelProxy((OTDebugElementsContainer)element);
+		}
+		return super.createModelProxy(element, context);
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java
new file mode 100644
index 0000000..04584b4
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java
@@ -0,0 +1,90 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDefaultVariableViewModelProxy.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
+import org.eclipse.objectteams.otdt.debug.IOTDebugEventListener;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.objectteams.otdt.debug.TeamInstance;
+
+/**
+ * This class mediates between the model and its view:
+ * 
+ * + Receive triggers from TeamBreakpointListener (via IOTDebugEventListener)
+ * + Create and fire ModelDelta events (received by TreeModelContentProvider)
+ * 
+ * Installation:
+ * + TreeModelContentProvider.inputChanged()->installModelProxy()
+ *   -> makes TreeModelContentProvider an fListener (modelChangedListener) of this
+ * 
+ * 
+ * @author stephan
+ * @since 1.1.2
+ */
+public class OTDefaultVariableViewModelProxy
+	extends AbstractModelProxy
+	implements IOTDebugEventListener
+{
+
+	private OTDebugElementsContainer container;
+
+	public OTDefaultVariableViewModelProxy(OTDebugElementsContainer debugElementsContainer) {
+		super();
+		this.container= debugElementsContainer;
+		OTDebugPlugin.getDefault().addOTDebugEventListener(this);
+	}
+
+	public void launched(ILaunch launch) {
+		// TODO Auto-generated method stub
+	}
+
+	public void teamInstantiated(TeamInstance newTeam) 
+	{
+		int idx= container.getIndexOfTeamInstance(newTeam);
+		ModelDelta delta= new ModelDelta(container, IModelDelta.NO_CHANGE);
+		delta.addNode(newTeam, idx, IModelDelta.INSERTED);
+		fireModelChanged(delta);
+	}
+
+	public void teamDisposed(int idx) {
+		ModelDelta delta= new ModelDelta(container, IModelDelta.NO_CHANGE);
+		delta.addNode(null, idx, IModelDelta.REMOVED);
+		fireModelChanged(delta);		
+	}
+
+	public void activationStateChanged(TeamInstance teamInstance) 
+	{
+		int idx= container.getIndexOfTeamInstance(teamInstance);
+		ModelDelta delta= new ModelDelta(container, IModelDelta.NO_CHANGE);
+		delta.addNode(teamInstance, idx, IModelDelta.STATE);
+		fireModelChanged(delta);		
+	}
+	
+	@Override
+	public synchronized void dispose() {
+		super.dispose();
+		OTDebugPlugin.getDefault().removeOTDebugEventListener(this);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTVariableColumnFactoryAdapter.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTVariableColumnFactoryAdapter.java
new file mode 100644
index 0000000..bca3f62
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTVariableColumnFactoryAdapter.java
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTVariableColumnFactoryAdapter.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnPresentation;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+
+/**
+ * Factory for default variable column presentation.
+ * (from VariableColumnFactoryAdaptor (since 3.2))
+ * 
+ * @since 1.1.2
+ */
+public class OTVariableColumnFactoryAdapter implements IColumnPresentationFactory {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresenetationFactoryAdapter#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext, java.lang.Object)
+	 */
+	public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
+		String id = context.getId();
+		if (OTDebugUIPlugin.TEAM_VIEW_ID.equals(id)) {
+			if (element instanceof OTDebugElementsContainer) {
+				return new VariableColumnPresentation();
+			}
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresenetationFactoryAdapter#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext, java.lang.Object)
+	 */
+	public String getColumnPresentationId(IPresentationContext context, Object element) {
+		String id = context.getId();
+		if (OTDebugUIPlugin.TEAM_VIEW_ID.equals(id)) {
+			if (element instanceof OTDebugElementsContainer) {
+				return VariableColumnPresentation.DEFAULT_VARIABLE_COLUMN_PRESENTATION;
+			}
+		}
+		return null;
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/TeamInstanceContentProvider.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/TeamInstanceContentProvider.java
new file mode 100644
index 0000000..3892b29
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/TeamInstanceContentProvider.java
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamInstanceContentProvider.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import org.eclipse.debug.internal.ui.model.elements.VariableContentProvider;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+
+/**
+ * Content provider for the fields of a team instance.
+ * Sole purpose compared to its superclass: make it applicable to the TeamView, too. 
+ * 
+ * Note, that filtering takes place within the debug.adaptor.VariablesViewAdaptor.
+ * 
+ * @author stephan
+ * @since 1.1.2
+ */
+public class TeamInstanceContentProvider extends VariableContentProvider 
+{
+	@Override
+	protected boolean supportsContextId(String id) {
+		return id.equals(OTDebugUIPlugin.TEAM_VIEW_ID);
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/TeamInstanceLabelProvider.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/TeamInstanceLabelProvider.java
new file mode 100644
index 0000000..befa3b3
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/TeamInstanceLabelProvider.java
@@ -0,0 +1,99 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamInstanceLabelProvider.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.model;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnPresentation;
+import org.eclipse.debug.internal.ui.model.elements.VariableLabelProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.TeamInstance;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugImages;
+
+/**
+ * Labels (text/image) for team instances in the TeamView.
+ * 
+ * @author stephan
+ * @since 1.1.2
+ */
+public class TeamInstanceLabelProvider extends VariableLabelProvider 
+{
+	@Override
+	protected String getLabel(TreePath elementPath, IPresentationContext context, String columnId) 
+			throws CoreException 
+	{
+//{ObjecgtTeams: new implementation, re-using only getColumnText():
+		Object element = elementPath.getLastSegment();
+		if (element instanceof TeamInstance) {	
+			IVariable variable= (IVariable) element;
+			if (isNameColumn(columnId))
+				return variable.getReferenceTypeName();
+			else
+				return getColumnText(variable, variable.getValue(), context, columnId);
+		}
+		return "<unknown element>"; //$NON-NLS-1$ // should never be seen
+// SH}
+	}
+	@Override
+	protected ImageDescriptor getImageDescriptor(
+			TreePath elementPath, IPresentationContext presentationContext, String columnId)
+			throws CoreException 
+	{
+		// completely new implementation for the OTDT:
+		if (isNameColumn(columnId)) {
+			TeamInstance teamInstance = (TeamInstance) elementPath.getLastSegment();
+			OTDebugElementsContainer _otDebugElementsContainer = (OTDebugElementsContainer) teamInstance.getLaunch().getAdapter(OTDebugElementsContainer.class);
+	
+			if (_otDebugElementsContainer != null && _otDebugElementsContainer.getTeamInstance(teamInstance) != null)
+			{
+				int activationState = teamInstance.getActivationState(_otDebugElementsContainer.getContext());
+				return getImageForState(activationState);
+			}
+			
+			//DefaultImage for Teams is inactive-Image
+			return getImageForState(0);
+		} 
+		return null;
+	}
+
+	private boolean isNameColumn(String columnId) {
+		return columnId == null
+		|| VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(columnId);
+	}
+	
+    private ImageDescriptor getImageForState(int activationState)
+    {
+        switch (activationState)
+        {
+        case TeamInstance.IS_INACTIVE:
+            return OTDebugImages.get(OTDebugImages.TEAM_INACTIVATED);
+        case TeamInstance.IS_IMPLICITACTIVE:
+        	return OTDebugImages.get(OTDebugImages.TEAM_IMPLICIT_ACTIVATED);            
+        case TeamInstance.IS_ACTIVE:
+        	return OTDebugImages.get(OTDebugImages.TEAM_ACTIVATED);
+        default:
+        	return OTDebugImages.get(OTDebugImages.TEAM_INACTIVATED);
+        }
+    } 
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencePage.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencePage.java
new file mode 100644
index 0000000..654d6fe
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencePage.java
@@ -0,0 +1,214 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugPreferencePage.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.preferences;
+
+import static org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences.CALLIN_STEPPING_TOKENS;
+import static org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences.DEBUG_CALLIN_STEPPING;
+import static org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences.DEBUG_FILTERS_ENABLED_BOOL;
+import static org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences.OT_GENERATED_CODE_COLOR;
+import static org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences.OT_SPECIAL_CODE_COLOR;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.debug.internal.ui.SWTFactory;
+import org.eclipse.debug.internal.ui.preferences.BooleanFieldEditor2;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.ColorFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+import org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferences;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.internal.Workbench;
+
+/**
+ * @author gis, stephan
+ */
+public class OTDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage
+{
+    private static final String JAVA_STEP_FILTER_PREFERENCE_PAGE = "org.eclipse.jdt.debug.ui.JavaStepFilterPreferencePage"; //$NON-NLS-1$
+
+	protected boolean _debugFiltersEnabled;
+
+    private Composite _parentComposite;
+	private ColorFieldEditor fGeneratedCodeColorFieldEditor;
+	private ColorFieldEditor fSpecialCodeColorFieldEditor;
+	private BooleanFieldEditor2 fDebugFilter;
+	/** sync with {@link OTDebugPreferences#CALLIN_STEPPING_TOKENS}: */
+	private String[] callinLabels = {OTDebugPreferencesMessages.OTDebugPreferencePage_callin_step_role_label, 
+								     OTDebugPreferencesMessages.OTDebugPreferencePage_callin_step_recurse_label, 
+								     OTDebugPreferencesMessages.OTDebugPreferencePage_callin_step_base_label};
+	
+    public OTDebugPreferencePage()
+    {
+    	super(GRID);
+    	setTitle(OTDebugPreferencesMessages.OTDebugPreferencePage_title);
+    }
+
+    public void createControl(Composite parent)
+    {
+        super.createControl(parent);
+        _parentComposite = parent;
+    }
+    
+    protected IPreferenceStore doGetPreferenceStore()
+    {
+        return OTDebugUIPlugin.getDefault().getPreferenceStore();
+    }
+    
+    protected void createFieldEditors()
+    {
+    	// container group:
+    	Composite groupAll= new Composite(getFieldEditorParent(), SWT.NONE);
+		GridLayout layout= new GridLayout();
+		layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+		layout.marginWidth= 0;
+		layout.verticalSpacing= convertVerticalDLUsToPixels(10);
+		layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+		groupAll.setLayout(layout);
+		
+		// block 1 group: stack frame filtering:
+		Group group = new Group(groupAll, SWT.NONE);
+		group.setLayout(new GridLayout());
+		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		group.setText(OTDebugPreferencesMessages.OTDebugPreferencePage_enable_filter_title);
+		
+		fDebugFilter = new BooleanFieldEditor2(DEBUG_FILTERS_ENABLED_BOOL, 
+											  OTDebugPreferencesMessages.OTDebugPreferencePage_enableFilter_label, 
+											  SWT.NONE, group); 
+		addField(fDebugFilter);
+		fDebugFilter.getChangeControl(groupAll).addSelectionListener(new SelectionListener() {
+			public void widgetDefaultSelected(SelectionEvent e) { }
+			public void widgetSelected(SelectionEvent e) {
+				setDebugFiltersEnabled(fDebugFilter.getBooleanValue());
+			}
+		});
+		
+		// block 2 group: stack frame coloring:
+		group = new Group(groupAll, SWT.NONE);
+		group.setLayout(new GridLayout());
+		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		group.setText(OTDebugPreferencesMessages.OTDebugPreferencePage_stackFrameColoringGroup_label);
+
+		Composite spacer = SWTFactory.createComposite(group, 2, 1, GridData.FILL_HORIZONTAL);
+		fGeneratedCodeColorFieldEditor = new ColorFieldEditor(OT_GENERATED_CODE_COLOR, 
+															  OTDebugPreferencesMessages.OTDebugPreferencePage_colorGeneratedCode_label, 
+															  spacer);
+		fGeneratedCodeColorFieldEditor.fillIntoGrid(spacer, 2);
+		addField(fGeneratedCodeColorFieldEditor);
+		
+		fSpecialCodeColorFieldEditor = new ColorFieldEditor(OT_SPECIAL_CODE_COLOR, 
+															OTDebugPreferencesMessages.OTDebugPreferencePage_colorSpecialCode_label, 
+															spacer);
+		fSpecialCodeColorFieldEditor.fillIntoGrid(spacer, 2);
+		addField(fSpecialCodeColorFieldEditor);
+		
+		// block 3 group: callin dispatch visualization:
+		group = new Group(groupAll, SWT.NONE);
+		group.setLayout(new GridLayout());
+		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		group.setText(OTDebugPreferencesMessages.OTDebugPreferencePage_callin_stepping_title);
+		
+		for (int i=0; i<CALLIN_STEPPING_TOKENS.length; i++) {
+			final String token = CALLIN_STEPPING_TOKENS[i];
+			final BooleanFieldEditor2 editor = new BooleanFieldEditor2(DEBUG_CALLIN_STEPPING+token, 
+														  this.callinLabels[i], 
+														  SWT.NONE, group); 
+			addField(editor);
+			editor.getChangeControl(group).addSelectionListener(new SelectionListener() {
+				public void widgetDefaultSelected(SelectionEvent e) { }
+				public void widgetSelected(SelectionEvent e) {
+					OTDebugPreferences.setCallinStepping(token, editor.getBooleanValue());
+				}
+			});
+		}
+		Label description= new Label(group, SWT.LEFT | SWT.WRAP);
+		Font font = description.getFont();
+		FontData[] data = font.getFontData();
+		data[0].setStyle(SWT.ITALIC);
+		description.setFont(new Font(font.getDevice(), data[0]));
+		description.setText(OTDebugPreferencesMessages.OTDebugPreferencePage_callin_stepping_hint); 
+		description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 0, 1));
+
+    }
+
+    protected void performDefaults()
+    {
+        OTDebugPreferences.propagateFilterFlag(getPreferenceStore());
+        super.performDefaults();
+    }
+    
+    /////////////// HACK synchronizing with JDT Debug step filter configuration
+    
+    private void setDebugFiltersEnabled(boolean enable)
+	{
+		if (_debugFiltersEnabled == enable)
+		    return;
+
+		_debugFiltersEnabled = enable;
+		
+		OTDebugPreferences.setUseOTStepFilters(enable);
+		updateStepFilteringPrefPage();
+	}
+    
+    private void updateStepFilteringPrefPage()
+    {
+        List prefs = Workbench.getInstance().getPreferenceManager().getElements(PreferenceManager.PRE_ORDER);
+		for (Iterator iter = prefs.iterator(); iter.hasNext();)
+        {
+            PreferenceNode node = (PreferenceNode) iter.next();
+            if(node.getId().indexOf(JAVA_STEP_FILTER_PREFERENCE_PAGE) != -1)
+            {
+                forcePreferencePageRecreation(node);
+            }
+        }
+    }
+
+    private void forcePreferencePageRecreation(PreferenceNode node)
+    {
+        IPreferencePage oldPage = node.getPage();
+        if (oldPage != null)
+        {
+            node.setPage(null);
+	        node.createPage();
+	        node.getPage().createControl(_parentComposite);
+	        
+	        oldPage.dispose();
+        }
+    }
+
+	public void init(IWorkbench workbench) { }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferences.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferences.java
new file mode 100644
index 0000000..542a34b
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferences.java
@@ -0,0 +1,160 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugPreferences.java 23435 2010-02-04 00:14:38Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.preferences;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.debug.internal.core.StepFilterManager;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants;
+import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
+import org.eclipse.jdt.internal.debug.ui.JavaDebugOptionsManager;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * @author gis
+ */
+public class OTDebugPreferences extends AbstractPreferenceInitializer {
+
+	// preference keys:
+	public final static String OT_GENERATED_CODE_COLOR = "org.eclipse.objectteams.otdt.debug.ui.OtGeneratedCodeColor"; //$NON-NLS-1$
+	public final static String OT_SPECIAL_CODE_COLOR   = "org.eclipse.objectteams.otdt.debug.ui.OtSpecialCodeColor"; //$NON-NLS-1$
+    public static final String DEBUG_FILTERS_ENABLED_BOOL = "prefs.ot.debugfilters.enabled"; //$NON-NLS-1$
+    
+    // key is the first constant plugs one of the tokens:
+    public static final String DEBUG_CALLIN_STEPPING = "org.eclipse.objectteams.otdt.debug.ui.OtCallinStepping."; // need to append token //$NON-NLS-1$
+    public static final String[] CALLIN_STEPPING_TOKENS = {"role", "recurse", "orig"};   //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    // special value:
+    public static final String CALLIN_STEPPING_NONE = "none"; //$NON-NLS-1$
+    
+    public static final String[] STEP_FILTER_PACKAGES = 
+    {
+        "de.fub.bytecode.*",                    //$NON-NLS-1$
+        "gnu.regexp.*",                         //$NON-NLS-1$
+        "org.eclipse.objectteams.otre",          //$NON-NLS-1$
+        "org.eclipse.objectteams.otre.jplis",    //$NON-NLS-1$
+        "org.eclipse.objectteams.otre.util"      //$NON-NLS-1$
+    };
+
+	@Override
+	public void initializeDefaultPreferences() {
+		IPreferenceStore prefs = OTDebugUIPlugin.getDefault().getPreferenceStore();
+		
+		PreferenceConverter.setDefault(prefs, OTDebugPreferences.OT_GENERATED_CODE_COLOR, new RGB(182, 182, 209));
+		PreferenceConverter.setDefault(prefs, OTDebugPreferences.OT_SPECIAL_CODE_COLOR,   new RGB(24, 152, 16));
+		
+		prefs.setDefault(OTDebugPreferences.DEBUG_FILTERS_ENABLED_BOOL, true);
+		
+		for (String token : CALLIN_STEPPING_TOKENS)
+			prefs.setDefault(OTDebugPreferences.DEBUG_CALLIN_STEPPING+token, true);
+	}
+    
+    public static void propagateFilterFlag(IPreferenceStore prefs)
+    {
+        setUseOTStepFilters(prefs.getBoolean(DEBUG_FILTERS_ENABLED_BOOL));
+    }
+
+    public static void setUseOTStepFilters(boolean enable)
+    {
+		IPreferenceStore jdiDebugStore = JDIDebugUIPlugin.getDefault().getPreferenceStore();
+		IPreferenceStore debugUIStore = DebugUIPlugin.getDefault().getPreferenceStore();
+		
+	    String stepFilterPackages = jdiDebugStore.getString(IJDIPreferencesConstants.PREF_ACTIVE_FILTERS_LIST);
+	    String newStepFilterPackages;
+		if (enable)
+		{
+	        newStepFilterPackages = addOTStepFilters(stepFilterPackages);
+		}
+		else
+		{
+	        newStepFilterPackages = removeOTStepFilters(stepFilterPackages);
+		}
+		
+		debugUIStore.setValue(StepFilterManager.PREF_USE_STEP_FILTERS, enable);
+		jdiDebugStore.setValue(IJDIPreferencesConstants.PREF_ACTIVE_FILTERS_LIST, newStepFilterPackages);
+		jdiDebugStore.setValue(IJDIPreferencesConstants.PREF_FILTER_SYNTHETICS, enable);
+    }
+
+    private static String addOTStepFilters(String values)
+    {
+        List result = new ArrayList();
+        String[] origEntries = JavaDebugOptionsManager.parseList(values);
+        for (int i = 0; i < origEntries.length; i++)
+	        result.add(origEntries[i]);
+        
+        String[] entriesToAdd = OTDebugPreferences.STEP_FILTER_PACKAGES;
+        
+        for (int i = 0; i < entriesToAdd.length; i++)
+        {
+            String entryToAdd = entriesToAdd[i];
+            if (!result.contains(entryToAdd))
+                result.add(entryToAdd);
+        }
+        
+        return JavaDebugOptionsManager.serializeList((String[])result.toArray(new String[result.size()]));
+    }
+    
+    private static String removeOTStepFilters(String values)
+    {
+        String[] entriesToRemove = OTDebugPreferences.STEP_FILTER_PACKAGES;
+        Arrays.sort(entriesToRemove);
+        String[] orig = JavaDebugOptionsManager.parseList(values);
+        List result = new ArrayList(entriesToRemove.length);
+        
+        for (int i = 0; i < orig.length; i++)
+        {
+            String origValue = orig[i];
+            if (Arrays.binarySearch(entriesToRemove, origValue) < 0)
+                result.add(origValue);
+        }
+        
+        return JavaDebugOptionsManager.serializeList((String[])result.toArray(new String[result.size()]));
+    }
+    /** Propagate callin stepping configuration down to the org.eclipse.objectteams.otdt.debug plugin. */
+	public static void setCallinStepping(String token, boolean value) {
+		IPreferenceStore prefs = OTDebugUIPlugin.getDefault().getPreferenceStore();
+		prefs.setValue(DEBUG_CALLIN_STEPPING+token, value);
+		OTDebugPlugin.getDefault().setCallinSteppingConfig(getCallinSteppingString());
+	}	
+	
+	public static String getCallinSteppingString() {
+		IPreferenceStore prefs = OTDebugUIPlugin.getDefault().getPreferenceStore();
+		String callinStepping = null;
+		for (String token : CALLIN_STEPPING_TOKENS) {
+			if (prefs.getBoolean(DEBUG_CALLIN_STEPPING+token)) {
+				if (callinStepping == null)
+					callinStepping = token;
+				else
+					callinStepping = callinStepping + ',' +token;
+			}
+		}
+		if (callinStepping == null)
+			callinStepping = CALLIN_STEPPING_NONE;
+		return callinStepping;
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencesMessages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencesMessages.java
new file mode 100644
index 0000000..69530f0
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencesMessages.java
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugPreferencesMessages.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.internal.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class OTDebugPreferencesMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.debug.ui.internal.preferences.OTDebugPreferencesMessages"; //$NON-NLS-1$
+	public static String OTDebugPreferencePage_title;
+	public static String OTDebugPreferencePage_enable_filter_title;
+	public static String OTDebugPreferencePage_enableFilter_label;
+	public static String OTDebugPreferencePage_stackFrameColoringGroup_label;
+	public static String OTDebugPreferencePage_colorGeneratedCode_label;
+	public static String OTDebugPreferencePage_colorSpecialCode_label;
+	public static String OTDebugPreferencePage_callin_stepping_title;
+	public static String OTDebugPreferencePage_callin_step_base_label;
+	public static String OTDebugPreferencePage_callin_step_recurse_label;
+	public static String OTDebugPreferencePage_callin_step_role_label;
+	public static String OTDebugPreferencePage_callin_stepping_hint;
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, OTDebugPreferencesMessages.class);
+	}
+
+	private OTDebugPreferencesMessages() {
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencesMessages.properties b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencesMessages.properties
new file mode 100644
index 0000000..fa738c5
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/preferences/OTDebugPreferencesMessages.properties
@@ -0,0 +1,11 @@
+OTDebugPreferencePage_title=Debug
+OTDebugPreferencePage_enable_filter_title=Stack frame filtering
+OTDebugPreferencePage_enableFilter_label=Hide stack frames of the Object Teams Runtime Environment
+OTDebugPreferencePage_stackFrameColoringGroup_label=Displaying OT/J-specific stack frames
+OTDebugPreferencePage_colorGeneratedCode_label=generated code
+OTDebugPreferencePage_colorSpecialCode_label=special OT/J code (method bindings etc.)
+OTDebugPreferencePage_callin_stepping_title=Visualization of callin dispatch
+OTDebugPreferencePage_callin_step_base_label=Show pending dispatch to original base method
+OTDebugPreferencePage_callin_step_recurse_label=Show pending recursive dispatch
+OTDebugPreferencePage_callin_step_role_label=Show pending dispatch to callin binding
+OTDebugPreferencePage_callin_stepping_hint=Unchecked steps will be skipped, the debugger will automatically step into the next action.
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java
new file mode 100644
index 0000000..22c95a4
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java
@@ -0,0 +1,286 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamView.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ * IBM Corporation - copies of individual methods from super class.
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.ui.views;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
+import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.objectteams.otdt.debug.IOTDTDebugPreferenceConstants;
+import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
+import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
+import org.eclipse.objectteams.otdt.debug.ui.internal.actions.ChangeTeamActivationAction;
+import org.eclipse.objectteams.otdt.debug.ui.internal.actions.SortTeamAction;
+import org.eclipse.objectteams.otdt.debug.ui.internal.actions.UpdateTeamViewAction;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+
+/**
+ * The TeamView aka "Team Monitor" for observing instantiation
+ * and (de)activation of teams.
+ * 
+ * This class was originally developed against Eclipse <= 3.2.
+ * For changes in VariablesView see 
+ * 		https://bugs.eclipse.org/bugs/show_bug.cgi?id=153500
+ * 
+ * @author gis
+ * 
+ * $Id: TeamView.java 23432 2010-02-03 23:13:42Z stephan $
+ */
+public class TeamView extends VariablesView implements ILaunchesListener2
+{
+	private static final String ACTION_ACTIVATE_TEAM = "ActivateTeam"; //$NON-NLS-1$
+	private static final String ACTION_DEACTIVATE_TEAM = "DeactivateTeam"; //$NON-NLS-1$
+	private static final String ACTION_UPDATE_TEAMVIEW = "action.update.teamview"; //$NON-NLS-1$
+	private String _sortMode;
+	private boolean _updatePermantently = false;
+	
+	private static boolean DEBUG= false;
+
+	public TeamView()
+	{
+		DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+		_sortMode = getDefaultSortMode();
+	}
+
+	@Override
+	protected String getPresentationContextId() {
+		return OTDebugUIPlugin.TEAM_VIEW_ID;
+	}
+	
+	public String getDefaultSortMode()
+	{
+		return IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER;
+	}
+
+	@Override // COPY_AND_PASTE from super, edited:
+	public void contextActivated(ISelection selection)
+	{
+		if (DEBUG) System.out.println("TV: contextActivated: "+selection); //$NON-NLS-1$
+		
+		if (!isAvailable() || !isVisible()) {
+			return;
+		}
+
+		if (selection instanceof IStructuredSelection) {
+//ObjectTeams: if there are multiselected DebugElements - show nothing
+			IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+			if(structuredSelection.size() == 1)
+  // orig:				
+				setViewerInput(structuredSelection.getFirstElement());
+  // :giro
+			else
+				setViewerInput(null);
+// carp+SH}
+		}
+		showViewer();
+
+		updateAction(VARIABLES_FIND_ELEMENT_ACTION);
+		updateAction(FIND_ACTION);
+	}
+	
+	@Override // COPY_AND_PASTE from super, edited:
+	protected void setViewerInput(Object context)
+	{
+		if (DEBUG) System.out.println("TV: setViewerInput: "+context); //$NON-NLS-1$
+
+//{ObjectTeams
+		if(!isSuspended(context) && !_updatePermantently)
+			return;
+// SH}
+		
+		if (context == null) {
+			// Clear the detail pane
+//{ObjectTeams: workaround invisible field fDetailPane:
+	/* orig:
+			fDetailPane.display(null);
+	  :giro */
+			refreshDetailPaneContents();
+// SH}
+		}
+		
+		Object current= getViewer().getInput();
+		
+		if (current == null && context == null) {
+			return;
+		}
+		
+//{ObjectTeams:
+		boolean hasContextChanged= false;
+		if ((context instanceof IStackFrame) || (context instanceof IThread) || (context instanceof IDebugTarget))
+		{
+			ILaunch launch = ((IDebugElement)context).getLaunch();
+			OTDebugElementsContainer newInput = (OTDebugElementsContainer) launch.getAdapter(OTDebugElementsContainer.class);
+			if (newInput != null) { // null for non-OT launches!
+				hasContextChanged= newInput.setContext((IDebugElement)context);
+				newInput.setSortMode(_sortMode);
+				context= newInput;
+			}
+		}
+// SH}
+		// OT: first condition added:
+		if (!hasContextChanged && current != null && current.equals(context)) {
+			return;
+		}
+		
+		showViewer();
+		getViewer().setInput(context);
+	}
+
+	private boolean isSuspended(Object context)
+	{
+		if (context instanceof OTDebugElementsContainer)
+			return ((OTDebugElementsContainer)context).isSuspended();
+		return true;
+	}
+
+	public IJavaThread getSelectedThread() {
+		Object input= getViewer().getInput();
+		if (input instanceof OTDebugElementsContainer)
+			return ((OTDebugElementsContainer)input).getContextThread();
+		return null; // no input!
+	}
+	
+	@Override
+	public void modelChanged(IModelDelta delta, IModelProxy proxy) {
+		throw new RuntimeException("TeamView.modelChanged() should not be called"); //$NON-NLS-1$
+	}
+	
+	public void launchesTerminated(ILaunch[] launches)
+	{
+		//clear TeamView
+		;
+	}
+
+	public void launchesRemoved(ILaunch[] launches) {}
+	public void launchesAdded(ILaunch[] launches) {}
+	public void launchesChanged(ILaunch[] launches) {}
+
+	public void dispose()
+	{
+		DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+		super.dispose();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
+	 */
+	public Viewer createViewer(Composite parent)
+	{
+		TreeModelViewer variablesViewer = (TreeModelViewer) super.createViewer(parent);
+		variablesViewer.removeModelChangedListener(this); // only register the proxy.
+		return variablesViewer;
+	}
+	
+	protected void createActions() 
+	{
+		super.createActions();
+		IActionBars actionBars = getViewSite().getActionBars();
+		IMenuManager viewMenu = actionBars.getMenuManager();
+		createSortActions(viewMenu);
+		// button:
+		setAction(ACTION_UPDATE_TEAMVIEW, new UpdateTeamViewAction(this));
+		
+		setAction(ACTION_ACTIVATE_TEAM, new ChangeTeamActivationAction(this, true));
+		setAction(ACTION_DEACTIVATE_TEAM, new ChangeTeamActivationAction(this, false));
+	} 	
+
+	private void createSortActions(IMenuManager viewMenu)
+	{
+		final SortTeamAction sortAction1 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER);
+		final SortTeamAction sortAction2 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_TIME);
+		final SortTeamAction sortAction3 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION);
+		final SortTeamAction sortAction4 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_NAME);
+		
+		final MenuManager layoutSubMenu = new MenuManager(TeamViewMessages.TeamView_0);
+		layoutSubMenu.setRemoveAllWhenShown(true);
+		layoutSubMenu.add(sortAction1);
+		layoutSubMenu.add(sortAction2);
+		layoutSubMenu.add(sortAction3);
+		layoutSubMenu.add(sortAction4);
+		viewMenu.add(layoutSubMenu);
+		viewMenu.add(new Separator());
+
+		layoutSubMenu.addMenuListener(new IMenuListener()
+		{
+			public void menuAboutToShow(IMenuManager manager)
+			{
+				layoutSubMenu.add(sortAction1);
+				layoutSubMenu.add(sortAction2);
+				layoutSubMenu.add(sortAction3);
+				layoutSubMenu.add(sortAction4);
+			}
+		});
+	}
+
+	@Override
+	protected void fillContextMenu(IMenuManager menu) {
+		super.fillContextMenu(menu);
+		menu.add(getAction(ACTION_ACTIVATE_TEAM)); 
+		menu.add(getAction(ACTION_DEACTIVATE_TEAM));
+	}
+	
+	protected String getToggleActionLabel()
+	{
+		return TeamViewMessages.TeamView_1; 
+	}
+
+	public void setSortMode(String sortMode)
+	{
+		_sortMode = sortMode;
+	}
+
+	protected void configureToolBar(IToolBarManager tbm)
+	{
+		super.configureToolBar(tbm);
+		tbm.add(new Separator(IDebugUIConstants.EMPTY_REGISTER_GROUP));		
+		tbm.add(new Separator(IDebugUIConstants.REGISTER_GROUP));
+		tbm.add(getAction(ACTION_UPDATE_TEAMVIEW));
+	}
+
+	public void setUpdatePermanently(boolean updatePermanently)
+	{
+		_updatePermantently = updatePermanently;
+		
+		//by default clear viewer
+		if(!updatePermanently)
+			setViewerInput(null);
+
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java
new file mode 100644
index 0000000..4332777
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java
@@ -0,0 +1,52 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: TeamViewMessages.java 23432 2010-02-03 23:13:42Z stephan $
+ * 
+ * Please visit http://www.objectteams.org for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/

+package org.eclipse.objectteams.otdt.debug.ui.views;

+

+import org.eclipse.osgi.util.NLS;

+

+public class TeamViewMessages extends NLS

+{

+	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.debug.ui.views.TeamViewMessages"; //$NON-NLS-1$

+

+	public static String SortTeamByName_0;

+

+	public static String SortTeamByActivation_0;

+

+	public static String SortTeamByActivation_1;

+	

+	public static String SortTeamByInstantiation_0;

+

+	public static String SortTeamDescription_0;

+	

+	public static String TeamView_0;

+

+	public static String TeamView_1;

+	

+	static

+	{

+		// initialize resource bundle

+		NLS.initializeMessages(BUNDLE_NAME, TeamViewMessages.class);

+	}

+

+	private TeamViewMessages()

+	{

+	}

+}

diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties
new file mode 100644
index 0000000..4c3538c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties
@@ -0,0 +1,28 @@
+###############################################################################

+ # This file is part of "Object Teams Development Tooling"-Software

+ # 

+ # Copyright 2004, 2005, 2006 Fraunhofer Gesellschaft, Munich, Germany,

+ # for its Fraunhofer Institute and Computer Architecture and Software

+ # Technology (FIRST), Berlin, Germany and Technical University Berlin,

+ # Germany.

+ # 

+ # All rights reserved. This program and the accompanying materials

+ # are made available under the terms of the Eclipse Public License v1.0

+ # which accompanies this distribution, and is available at

+ # http://www.eclipse.org/legal/epl-v10.html

+ # $Id: AspectBundleRole.java 14430 2006-09-23 12:06:21Z stephan $

+ # 

+ # Please visit http://www.objectteams.org for updates and contact.

+ # 

+ # Contributors:

+ # Fraunhofer FIRST - Initial API and implementation

+ # Technical University Berlin - Initial API and implementation

+ ###############################################################################

+ 

+TeamView_0=Sort Teams

+TeamView_1=Team View Only

+SortTeamByName_0=Sort Teams by Name

+SortTeamByActivation_0=Sort Teams by Activation Time

+SortTeamByActivation_1=Sort Teams by Activation Order

+SortTeamByInstantiation_0=Sort Teams by Instantiation Time

+SortTeamDescription_0=By Default Teams are sorted by Activation Order.

diff --git a/plugins/org.eclipse.objectteams.otdt.debug/.classpath b/plugins/org.eclipse.objectteams.otdt.debug/.classpath
new file mode 100644
index 0000000..304e861
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/.cvsignore b/plugins/org.eclipse.objectteams.otdt.debug/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/.project b/plugins/org.eclipse.objectteams.otdt.debug/.project
new file mode 100644
index 0000000..0cca0d4
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.objectteams.otdt.debug</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otdt.debug/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6305aca
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,57 @@
+#Tue Sep 18 18:19:36 CEST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..37af2cb
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTDebug Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.debug;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Bundle-Activator: org.eclipse.objectteams.otdt.debug.OTDebugPlugin
+Bundle-Vendor: Fraunhofer FIRST
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.debug,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.core,
+ org.eclipse.core.resources,
+ org.eclipse.objectteams.otdt
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.objectteams.otdt.debug,
+ org.eclipse.objectteams.otdt.debug.core.breakpoints,
+ org.eclipse.objectteams.otdt.debug.internal
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/build.properties b/plugins/org.eclipse.objectteams.otdt.debug/build.properties
new file mode 100644
index 0000000..0c93900
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .
+src.includes = .project,\
+               .classpath,\
+               build.properties
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.launch b/plugins/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.launch
new file mode 100644
index 0000000..814e921
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.launch
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/org.eclipse.objectteams.otdt.debug&quot; type=&quot;4&quot;/&gt;&#10;&lt;/resources&gt;}"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.sh}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="${project_loc:OTRE}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.objectteams.otdt.debug}"/>
+</launchConfiguration>
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.sh b/plugins/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.sh
new file mode 100644
index 0000000..0b700bd
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/scripts/genIOOTBreakPoints.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# This script is inteded to be invoked from within eclipse 
+# using the launch configuration genIOOTBreakPoints.launch
+# in the same directory.
+# Prerequisite: 
+# You must have the project OTRE within the same workspace.
+#
+# author: stephan@cs.tu-berlin.de
+
+
+# Let's identify ourselves:
+CWD=`pwd`
+PROG=`echo $0 | sed "s|${CWD}/||"`
+
+HEADER="/**********************************************************************
+ * This file is part of \"Object Teams Development Tooling\"-Software
+ * 
+ * Copyright 2006, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * \$Id\$
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.core.breakpoints;
+
+/** 
+ *  Do not edit: This interface is auto-generated from org/objectteams/Team.java 
+ *  using ${PROG}
+ *
+ *  Purpose: make specific line numbers of Team.java available for the debugger.
+ */
+public interface IOOTBreakPoints 
+{"
+
+
+# INPUT:
+OTRE=$1
+if [ ! -d ${OTRE} ]; then
+	echo "Project root of OTRE not found at ${OTRE}".
+	echo "Perhaps you don't have project OTRE in your workspace?"
+	exit
+fi
+TEAM=${OTRE}/src/org/objectteams/Team.java
+if [ ! -f ${TEAM} ]; then
+	echo "Team.java not found at ${TEAM}."
+	exit
+fi
+
+# OUTPUT:
+OUT=src/org/objectteams/otdt/debug/core/breakpoints/IOOTBreakPoints.java
+
+if [ "$2" != "RUN" ]
+then
+    # fetch stdin from Team.java, write to IOOTBreakPoints.java and restart:
+    $0 $1 RUN 0<"$TEAM" | tee $OUT
+    echo ">>>> Please refresh the source folder. <<<<"
+    exit
+else
+
+	echo "${HEADER}"
+    i=0
+    while read 
+    do
+        i=`expr $i + 1`
+        l=`echo "$REPLY" | sed -e "s/^.*[$]Debug(\(.*\))/\1/"`
+        if [ "$REPLY" != "$l" ]
+        then
+            echo "  int LINE_$l = $i;"
+        fi
+    done
+	echo "}"
+fi
+
+
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTDTDebugPreferenceConstants.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTDTDebugPreferenceConstants.java
new file mode 100644
index 0000000..59cfc62
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTDTDebugPreferenceConstants.java
@@ -0,0 +1,33 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug;

+

+public interface IOTDTDebugPreferenceConstants

+{

+

+	/**

+	 * The sort mode for teams in Teamview

+	 */

+	public static final String TEAMS_BY_NAME = "Teams.by.name"; //$NON-NLS-1$

+	public static final String TEAMS_BY_INSTANTIATION = "Teams.by.instantiation"; //$NON-NLS-1$

+	public static final String TEAMS_BY_ACTIVATION_TIME = "Teams.by.activationtime"; //$NON-NLS-1$

+	public static final String TEAMS_BY_ACTIVATION_ORDER = "Teams.by.activationorder"; //$NON-NLS-1$

+}

diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTDebugEventListener.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTDebugEventListener.java
new file mode 100644
index 0000000..6b912ce
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTDebugEventListener.java
@@ -0,0 +1,34 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: IOTDebugEventListener.java 23427 2010-02-03 22:23:59Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug;
+
+import org.eclipse.debug.core.ILaunch;
+
+/**
+ * @author gis
+ */
+public interface IOTDebugEventListener
+{
+    public void launched(ILaunch launch);
+    public void teamInstantiated(TeamInstance newTeam);
+    public void teamDisposed(int idx);
+    public void activationStateChanged(TeamInstance teamInstance);
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTLaunchConstants.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTLaunchConstants.java
new file mode 100644
index 0000000..26cbed3
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/IOTLaunchConstants.java
@@ -0,0 +1,43 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: IOTLaunchConstants.java 23427 2010-02-03 22:23:59Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug;
+
+
+/**
+ * @author resix
+ */
+public interface IOTLaunchConstants {
+	public static final String uniquePrefix = "org.eclipse.objectteams.otdt.debug"; //$NON-NLS-1$
+	/**
+	 * Launch configuration attribute key. The value is a list of team names
+	 * to be woven and activated automatically in this objectteams launch configuration.
+	 */
+	public static final String ATTR_TEAMCONFIG_LIST = uniquePrefix + ".TEAMCONFIG_ATTR"; //$NON-NLS-1$
+	
+	/**
+	 * Launch configuration attribute key. The value states, if the teams in the objectteams 
+	 * launch configuration will be actually used while launching.
+	 */
+	public static final String ATTR_TEAMCONFIG_ACTIVE = uniquePrefix + ".TEAMCONFIG_ACTIVE_ATTR"; //$NON-NLS-1$
+
+	public static final String ATTR_USE_JPLIS = uniquePrefix + ".USE_JPLIS"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugElementsContainer.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugElementsContainer.java
new file mode 100644
index 0000000..7a75e4c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugElementsContainer.java
@@ -0,0 +1,228 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugElementsContainer.java 23427 2010-02-03 22:23:59Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.eclipse.core.internal.runtime.AdapterManager;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+import org.eclipse.jdt.internal.debug.core.model.JDIThisVariable;
+import org.eclipse.objectteams.otdt.debug.internal.util.TeamActivationOrderComparator;
+import org.eclipse.objectteams.otdt.debug.internal.util.TeamActivationTimeComparator;
+import org.eclipse.objectteams.otdt.debug.internal.util.TeamInstantiantionComparator;
+import org.eclipse.objectteams.otdt.debug.internal.util.TeamNameComparator;
+
+/**
+ * One instance of this class exists per launch (ensured by OTDebugElementsContainerFactory).
+ * At each point in time, each OTDebugElementsContainer also refers to a specific "context" - 
+ * either of:
+ * <ul>
+ * <li> ILaunch </li>
+ * <li> IThread </li>
+ * <li> IStackFrame </li>
+ * </ul>
+ * Depending on the context of the Container a current thread can be requested (IThread/IStackFrame).
+ * 
+ * A list of known team instances is maintained, which is always sorted according to the 
+ * current sorting mode.
+ * 
+ * @author ike
+ * $Id: OTDebugElementsContainer.java 23427 2010-02-03 22:23:59Z stephan $
+ */
+public class OTDebugElementsContainer implements IAdaptable
+{
+    private ArrayList<TeamInstance> _teamInstances = new ArrayList<TeamInstance>();
+    private IDebugElement _context;
+	private String _sortMode;
+
+	/** @category lifecycle */
+	public Object getAdapter(Class adapter)
+	{
+		return AdapterManager.getDefault().getAdapter(this, adapter);
+	}
+	
+	/** @category lifecycle */
+	public IDebugElement getContext()
+	{
+		return _context;
+	}
+
+	/**
+	 * @category lifecycle 
+	 * 
+	 * @param context
+	 * @return true if the context actually changed (refresh needed).
+	 */
+	public boolean setContext(IDebugElement context)
+	{
+		if (this._context == context)
+			return false;
+		_context = context;
+		return true; 
+	}
+	
+	/** @category lifecycle */
+	public void dispose()
+	{
+		_teamInstances.clear();
+	}
+	
+	/** @throws DebugException 
+	 * @category modification */
+    public TeamInstance addTeamInstance(JDIThisVariable teamVariable) 
+    		throws DebugException
+    {
+    	TeamInstance teamInstance = getTeamInstance(teamVariable);
+    	if (teamInstance== null)
+        {
+        	teamInstance = new TeamInstance(teamVariable);
+        	_teamInstances.add(teamInstance);
+    		sortTeamInstances();
+        }
+        
+        return teamInstance;
+    }
+    
+    /** @category modification */
+    public int removeTeamInstance(IJavaVariable teamVariable)
+    {
+    	for (int i=0; i<this._teamInstances.size(); i++)
+    	{
+    		if(this._teamInstances.get(i).equals(teamVariable))
+    		{
+    			_teamInstances.remove(i);
+    			return i;
+    		}
+		}
+    	return -1;
+    }
+    
+    /** @category modification */
+	public void setSortMode(String sortMode)
+	{
+		String oldSortMode= _sortMode;
+		_sortMode = sortMode;
+		if (sortMode != null && !sortMode.equals(oldSortMode))
+			sortTeamInstances();
+	}
+
+	/** @category modification */
+	private void sortTeamInstances()
+	{
+		if (_sortMode == null)
+			return;
+		if(_sortMode.equals(IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_TIME))
+		{
+			Collections.sort(_teamInstances, new TeamActivationTimeComparator());
+		}
+		if(_sortMode.equals(IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER))
+		{
+			Collections.sort(_teamInstances, new TeamActivationOrderComparator());
+		}
+		if(_sortMode.equals(IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION))
+		{
+			Collections.sort(_teamInstances, new TeamInstantiantionComparator());
+		}
+		if(_sortMode.equals(IOTDTDebugPreferenceConstants.TEAMS_BY_NAME))
+		{
+			Collections.sort(_teamInstances, new TeamNameComparator());
+		}
+	}
+
+	/** @category query */
+	public boolean hasTeamInstances()
+	{
+		return !_teamInstances.isEmpty();
+	}
+
+	/** @category query */
+	public int getChildCount() {
+		return _teamInstances.size();
+	}
+
+	/** @category query */
+    public TeamInstance getTeamInstance(IJavaVariable teamVariable)
+    {
+    	for (Iterator iter = _teamInstances.iterator(); iter.hasNext();)
+    	{
+			TeamInstance teamInstance = (TeamInstance) iter.next();
+    		if(teamInstance.equals(teamVariable))
+    			return teamInstance;
+    	}
+		return null;
+    }
+    
+    /** @category query */
+    public int getIndexOfTeamInstance(TeamInstance teamInstance) {
+    	for (int i = 0; i < this._teamInstances.size(); i++)
+			if (this._teamInstances.get(i).equals(teamInstance))
+				return i;
+
+    	return -1;
+    }
+
+    /** @category query */
+    public ArrayList<TeamInstance> getTeamInstances()
+    {
+		return _teamInstances;
+    }
+
+    /** 
+     * @category query
+     * 
+     * If the current context is either an IJavaThread or an IStackFrame,
+     * return the (corresponding) thread.
+     */
+	public IJavaThread getContextThread() {
+		if (this._context instanceof IJavaThread)
+			return (IJavaThread) this._context;
+		if (this._context instanceof IStackFrame) 
+			return (IJavaThread)((IStackFrame) this._context).getThread();
+		return null; // no specific thread selected
+	}
+
+	/** 
+	 * @category query
+	 * 
+	 * If the current context has a thread, ask whether it is suspended,
+	 * otherwise ask whether some thread is suspended (by using canResume()).
+	 */
+	public boolean isSuspended() {
+		IJavaThread contextThread = getContextThread();
+		if (contextThread != null && contextThread.isSuspended())
+			return true;
+		IDebugTarget target= null;
+		if (this._context instanceof IDebugTarget)
+			target = (IDebugTarget) this._context;
+		else
+			target= this._context.getDebugTarget();
+		return target.canResume();
+	}
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java
new file mode 100644
index 0000000..5a76d1d
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java
@@ -0,0 +1,370 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTDebugPlugin.java 23427 2010-02-03 22:23:59Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+import org.eclipse.objectteams.otdt.core.exceptions.ExceptionHandler;
+import org.eclipse.objectteams.otdt.debug.internal.Logger;
+import org.eclipse.objectteams.otdt.debug.internal.OTDebugElementsContainerFactory;
+import org.eclipse.objectteams.otdt.debug.internal.RoleBreakpointListener;
+import org.eclipse.objectteams.otdt.debug.internal.StepFromLinenumberGenerator;
+import org.eclipse.objectteams.otdt.debug.internal.TeamBreakpointListener;
+import org.eclipse.objectteams.otdt.debug.internal.TempFileManager;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class OTDebugPlugin extends Plugin 
+{
+	public static final String PLUGIN_ID = "org.eclipse.objectteams.otdt.debug"; //$NON-NLS-1$
+	public static final String OT_LAUNCH = "org.eclipse.objectteams.launch"; //$NON-NLS-1$
+	/**
+	 * @deprecated reference to a removed launch configuration type.
+	 */
+    public static final String OT_LAUNCH_CONFIGURATION_TYPE = "org.objectteams.otdt.debug.LaunchConfigurationType"; //$NON-NLS-1$
+    
+    private OTDebugElementsContainerFactory _containerFactory;
+
+    class OTDebugLaunchManager implements ILaunchesListener2
+	{
+        private Vector<ILaunch> _otLaunches;
+        
+		public OTDebugLaunchManager()
+		{
+			ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+			
+			if (launches != null)
+			{
+				_otLaunches = new Vector<ILaunch>();
+				for (int i = 0; i < launches.length; i++) 
+				{
+                    if (isOTDebugLaunch(launches[i]))
+                        _otLaunches.add(launches[i]);
+				}
+				checkOTLaunches(_otLaunches.size());
+			}
+		}
+		
+		public void terminateOTLaunches()
+		{
+		    // operate on a copy of _otLaunches to prevent concurrent modification
+		    ILaunch[] launches = new ILaunch[_otLaunches.size()];
+		    _otLaunches.copyInto(launches);
+		    
+		    for (int i = 0; i < launches.length; i++)
+            {
+                try {
+	                launches[i].terminate();
+                }
+                catch (DebugException ex) { // only log
+                    OTDebugPlugin.getExceptionHandler().logCoreException("Unable to terminate launch on bundle shutdown", ex); //$NON-NLS-1$
+                }
+            }
+		}
+		
+		public int getOTLaunchesCount() 
+		{
+			return _otLaunches.size();
+		}
+
+		private boolean isOTDebugLaunch(ILaunch launch)
+		{
+			try 
+			{
+				if (ILaunchManager.DEBUG_MODE.equals(launch.getLaunchMode())) { 
+					String isOTLaunch = launch.getAttribute(OT_LAUNCH);
+					if (isOTLaunch != null && isOTLaunch.equals("true")) //$NON-NLS-1$
+						return true;
+					if (launch.getLaunchConfiguration() != null) 
+						return launch.getLaunchConfiguration().getAttribute(OT_LAUNCH, false);
+				}
+			}
+			catch (CoreException ex)
+			{}
+			return false;
+		}
+
+        public void launchesAdded(ILaunch[] launches)
+        {
+            for (int idx = 0; idx < launches.length; idx++)
+            {
+                ILaunch launch = launches[idx];
+                if (isOTDebugLaunch(launch) && !_otLaunches.contains(launch))
+                {
+                    _otLaunches.add(launch);
+                    checkOTLaunches(_otLaunches.size());
+                }
+            }
+        }
+        
+        public void launchesTerminated(ILaunch[] launches)
+        {
+            forgetOTLaunches(launches);
+        }
+        
+        private void forgetOTLaunches(ILaunch[] launches)
+        {
+            for (int idx = 0; idx < launches.length; idx++)
+            {
+                ILaunch launch = launches[idx];
+                if (isOTDebugLaunch(launch) && _otLaunches.contains(launch))
+                {
+                    _otLaunches.remove(launch);
+                    checkOTLaunches(_otLaunches.size());
+                    otLaunchFinished(launch);
+                }
+            }
+            assert(_otLaunches.size() >= 0);
+        }
+
+        //we're not interested in this
+        public void launchesRemoved(ILaunch[] launches){}
+        public void launchesChanged(ILaunch[] launches){}
+	}
+	
+	private void otLaunchFinished(ILaunch launch)
+    {
+	    if (_tempFileManager != null) // we're really cautious today
+	        _tempFileManager.deleteTempFile(launch);
+    }
+	
+    //The shared instance.
+	private static OTDebugPlugin plugin;
+	//Resource bundle.
+	private ResourceBundle resourceBundle;
+	
+	private OTDebugLaunchManager _otLaunchManager;
+	private TeamBreakpointListener _otTeamBreakpointListener;
+	private RoleBreakpointListener _otRoleBreakpointListener;
+    private IOTDebugEventListener[] _listeners = new IOTDebugEventListener[0];
+    private TempFileManager _tempFileManager;
+    private StepFromLinenumberGenerator _stepGenerator;
+    private String _callinSteppingConfig = null;
+    
+	public OTDebugPlugin() 
+	{
+		super();
+		plugin = this;
+		try {
+			resourceBundle = ResourceBundle.getBundle("org.eclipse.objectteams.otdt.debug.OTDebugPluginResources"); //$NON-NLS-1$
+		} catch (MissingResourceException x) {
+			resourceBundle = null;
+		}
+	}
+	
+	public void setCallinSteppingConfig(String config) {
+		this._callinSteppingConfig = config;
+	}
+	public String getCallinSteppingConfig() {
+		return this._callinSteppingConfig;
+	}
+
+	public static Status createErrorStatus(String message)
+	{
+	    return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, null);
+	}
+	
+	public static Status createErrorStatus(String message, Throwable exception)
+	{
+	    return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, exception);
+	}
+	
+	/**
+	 * This method is called upon plug-in activation
+	 */
+	public void start(BundleContext context) throws Exception 
+	{
+		super.start(context);
+
+		_otLaunchManager = new OTDebugLaunchManager();
+		DebugPlugin.getDefault().getLaunchManager().addLaunchListener(_otLaunchManager);
+	}
+
+	/**
+	 * This method is called when the plug-in is stopped
+	 */
+	public void stop(BundleContext context) throws Exception 
+	{
+		// when this plugin is stopped, terminate any running OT launches
+	    unregisterOTDebugSupport();
+	    _otLaunchManager.terminateOTLaunches();
+		
+		DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(_otLaunchManager);
+		_otLaunchManager = null;
+		if (_tempFileManager != null)
+		{
+			_tempFileManager.deleteAll();
+			_tempFileManager = null;
+		}
+		
+		super.stop(context);
+	}
+
+    /**
+	 * Returns the shared instance.
+	 */
+	public static OTDebugPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns the string from the plugin's resource bundle,
+	 * or 'key' if not found.
+	 */
+	public static String getResourceString(String key) {
+		ResourceBundle bundle = OTDebugPlugin.getDefault().getResourceBundle();
+		try {
+			return (bundle != null) ? bundle.getString(key) : key;
+		} catch (MissingResourceException e) {
+			return key;
+		}
+	}
+
+	/**
+	 * Returns the plugin's resource bundle,
+	 */
+	public ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+
+	public static ExceptionHandler getExceptionHandler()
+	{
+		return new ExceptionHandler(PLUGIN_ID);
+	}
+
+	public TempFileManager getTempFileManager()
+    {
+	    if (_tempFileManager == null)
+	        _tempFileManager = new TempFileManager();
+	    
+        return _tempFileManager;
+    }
+
+	public IOTDebugEventListener[] getOTDebugEventListeners()
+    {
+        return _listeners;
+    }
+
+	public void addOTDebugEventListener(IOTDebugEventListener listener)
+	{
+	    int newLength = _listeners.length + 1;
+	    IOTDebugEventListener[] newListeners = new IOTDebugEventListener[newLength];
+	    System.arraycopy(_listeners, 0, newListeners, 0, _listeners.length);
+	    newListeners[_listeners.length] = listener;
+	    _listeners = newListeners;
+	}
+	
+	public void removeOTDebugEventListener(IOTDebugEventListener listener)
+	{
+	    int occurrences = 0;
+	    for (int i = 0; i < _listeners.length; i++)
+        {
+            if (listener.equals(_listeners[i]))
+                occurrences++;
+        }
+
+	    if (occurrences > 0)
+	    {
+		    int newLength = _listeners.length - occurrences;
+		    IOTDebugEventListener[] newListeners = new IOTDebugEventListener[newLength];
+
+		    int insertionIndex = 0;
+		    for (int i = 0; i < _listeners.length; i++)
+	        {
+	            if (!listener.equals(_listeners[i]))
+	                newListeners[insertionIndex++] = _listeners[i];
+	        }
+
+	        _listeners = newListeners;
+	    }
+	}
+	
+	public void checkOTLaunches(int otLaunchCount)
+	{
+		// Note: the order seems to be undefined! After finishing a launch, we do not 
+		// immediately get the launchRemoved event. We may first get another launchAdded 
+		// and then the previous launchRemoved. So we can't rely on the counter being 
+		// 0 or 1 here.
+		if (otLaunchCount <= 0)
+		{
+			unregisterOTDebugSupport();
+		}
+		else if (_otTeamBreakpointListener == null)
+			registerOTDebugSupport();
+	}
+
+	private void registerOTDebugSupport() 
+	{
+		assert(_otTeamBreakpointListener == null);
+		
+		 _containerFactory= new OTDebugElementsContainerFactory();
+		Platform.getAdapterManager().registerAdapters(_containerFactory, ILaunch.class);
+		
+		_otTeamBreakpointListener = TeamBreakpointListener.getInstance();
+		_otRoleBreakpointListener = RoleBreakpointListener.getInstance();
+		_stepGenerator = StepFromLinenumberGenerator.getInstance();
+
+		DebugPlugin.getDefault().addDebugEventFilter(_stepGenerator);
+		JDIDebugPlugin.getDefault().addJavaBreakpointListener(_otTeamBreakpointListener);
+		JDIDebugPlugin.getDefault().addJavaBreakpointListener(_otRoleBreakpointListener);
+	}
+
+	private void unregisterOTDebugSupport() 
+	{
+		if (_otTeamBreakpointListener != null)
+		{
+			DebugPlugin.getDefault().removeDebugEventFilter(_stepGenerator);
+			JDIDebugPlugin.getDefault().removeJavaBreakpointListener(_otTeamBreakpointListener);
+			JDIDebugPlugin.getDefault().removeJavaBreakpointListener(_otRoleBreakpointListener);
+			try
+            {
+                TeamBreakpointInstaller.uninstallTeamBreakpoints();
+            }
+            catch (CoreException e)
+            {
+                Logger.log(0,"OTDebugPlugin.unregisterOTDebugSupport()","ERROR unable to remove Breakpoints"); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+            _otTeamBreakpointListener.dispose();
+            _otTeamBreakpointListener = null;
+
+            _otRoleBreakpointListener.dispose();
+            _otRoleBreakpointListener = null;
+		}
+        if (_containerFactory != null)
+           	_containerFactory.dispose();
+        _containerFactory= null;
+	}
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTLaunchConfigMigrationDelegate.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTLaunchConfigMigrationDelegate.java
new file mode 100644
index 0000000..b289ec7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTLaunchConfigMigrationDelegate.java
@@ -0,0 +1,89 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OTLaunchConfigMigrationDelegate.java 23427 2010-02-03 22:23:59Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug;
+
+import java.util.HashMap;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.internal.core.LaunchConfiguration;
+import org.eclipse.debug.internal.core.LaunchConfigurationInfo;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+
+/**
+ * This class migrates old OT-launches (Java App, OT/Equinox FW, OTEclipse App) into regular
+ * Eclipse launches, but marked as OTlaunch, thereby enabling the OTRE, OT/Equinox, resp.
+ * 
+ * @author stephan
+ * @since 1.2.2
+ */
+public class OTLaunchConfigMigrationDelegate implements ILaunchConfigurationMigrationDelegate {
+
+	final static HashMap<String,String> oldToNew = new HashMap<String, String>();
+	static {
+		oldToNew.put(OTDebugPlugin.OT_LAUNCH_CONFIGURATION_TYPE, 	IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
+		// 'referencing' constants from downstream plug-ins (old, removed launch configuration types)
+		oldToNew.put("org.objectteams.otdt.pde.ui.OTEquinoxLaunchConfigurationType", 		  "org.eclipse.pde.ui.EquinoxLauncher");  //$NON-NLS-1$ //$NON-NLS-2$
+		oldToNew.put("org.objectteams.otdt.pde.ui.EclipseApplicationLaunchConfigurationType", "org.eclipse.pde.ui.RuntimeWorkbench"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	
+	@SuppressWarnings("nls")
+	public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException {
+		String candidateType = candidate.getType().getIdentifier();
+		return   candidateType.startsWith("org.objectteams.otdt")
+			  && oldToNew.containsKey(candidateType);
+	}
+
+	public void migrate(final ILaunchConfiguration candidate) throws CoreException {
+		final String newId = oldToNew.get(candidate.getType().getIdentifier());
+		if (newId == null) return;
+		ILaunchConfiguration wrapper = new LaunchConfiguration(candidate.getMemento()) {
+			@Override
+			protected LaunchConfigurationInfo getInfo() throws CoreException {
+				return new LaunchConfigurationInfo() {
+					@Override
+					protected ILaunchConfigurationType getType() {
+						// revert to plain Eclipse launch type:
+						return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(newId);
+					}
+					@SuppressWarnings("unchecked")
+					@Override
+					protected TreeMap getAttributes() {
+						try {
+							TreeMap orig = (TreeMap) candidate.getWorkingCopy().getAttributes();
+							// but ensure it is marked as an OT-launch:
+							orig.put(OTDebugPlugin.OT_LAUNCH, Boolean.TRUE);
+							return orig;
+						} catch (CoreException e) { /* silent. */ }
+						return new TreeMap(); // must not return null
+					}
+				};
+			}
+		};
+		wrapper.getWorkingCopy().doSave();
+	}
+
+}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
new file mode 100644
index 0000000..cc48eb6
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
@@ -0,0 +1,258 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+