瀏覽代碼

Removed Debug Threads, removed tree zupdate adapter

Andreas Muelder 9 年之前
父節點
當前提交
9a9a5005d1

+ 2 - 63
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/debugmodel/SCTDebugTarget.java

@@ -10,10 +10,6 @@
  */
 package org.yakindu.sct.simulation.core.debugmodel;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 import org.eclipse.core.resources.IMarkerDelta;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.CoreException;
@@ -27,18 +23,12 @@ import org.eclipse.debug.core.model.IMemoryBlock;
 import org.eclipse.debug.core.model.IProcess;
 import org.eclipse.debug.core.model.IStep;
 import org.eclipse.debug.core.model.IThread;
-import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.impl.AdapterImpl;
 import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
 import org.yakindu.base.base.NamedElement;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.RegularState;
 import org.yakindu.sct.simulation.core.engine.IExecutionControl;
 import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
-import org.yakindu.sct.simulation.core.sruntime.SRuntimePackage;
-import org.yakindu.sct.simulation.core.sruntime.util.CrossDocumentContentAdapter;
 
 /**
  * 
@@ -55,7 +45,6 @@ public class SCTDebugTarget extends SCTDebugElement implements IDebugTarget, ISt
 	private boolean suspended = false;
 
 	private final NamedElement element;
-	protected List<SCTDebugThread> threads;
 
 	protected ISimulationEngine engine;
 
@@ -72,15 +61,9 @@ public class SCTDebugTarget extends SCTDebugElement implements IDebugTarget, ISt
 	}
 
 	public void init() {
-		threads = new ArrayList<SCTDebugThread>();
 		executionControl = engine.getExecutionControl();
 		executionControl.init();
 		DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
-		engine.getExecutionContext().eAdapters().add(updater = createUpdater());
-	}
-
-	protected AdapterImpl createUpdater() {
-		return new UpdateTreeAdapter();
 	}
 
 	public void start() {
@@ -97,37 +80,11 @@ public class SCTDebugTarget extends SCTDebugElement implements IDebugTarget, ISt
 	}
 
 	public synchronized IThread[] getThreads() throws DebugException {
-		// Collect all active regions
-		List<RegularState> activeLeafStates = engine.getExecutionContext().getActiveStates();
-		List<Region> activeRegions = new ArrayList<Region>();
-		for (RegularState vertex : activeLeafStates) {
-			activeRegions.add(vertex.getParentRegion());
-		}
-		// Remove orphaned debug threads
-		Iterator<SCTDebugThread> iterator = threads.iterator();
-		while (iterator.hasNext()) {
-			SCTDebugThread next = iterator.next();
-			if (!activeRegions.contains(next.getElement())) {
-				iterator.remove();
-			}
-		}
-		// Add new debug threads
-		for (Region region : activeRegions) {
-			boolean found = false;
-			for (SCTDebugThread thread : threads) {
-				if (thread.getElement() == region) {
-					found = true;
-				}
-			}
-			if (!found) {
-				threads.add(new SCTDebugThread(this, engine, getResourceString(), region));
-			}
-		}
-		return threads.toArray(new IThread[] {});
+		return new IThread[] {};
 	}
 
 	public boolean hasThreads() throws DebugException {
-		return true;
+		return false;
 	}
 
 	public String getName() throws DebugException {
@@ -244,24 +201,6 @@ public class SCTDebugTarget extends SCTDebugElement implements IDebugTarget, ISt
 		return engine;
 	}
 
-	// Fires fireChangeEvents to refresh the DebugUI TreeViewer with the active
-	// states
-	public class UpdateTreeAdapter extends CrossDocumentContentAdapter {
-
-		@Override
-		protected boolean shouldAdapt(EStructuralFeature feature) {
-			return feature == SRuntimePackage.Literals.EXECUTION_CONTEXT__ACTIVE_STATES;
-		}
-
-		@Override
-		public void notifyChanged(Notification notification) {
-			if (notification.getFeature() == SRuntimePackage.Literals.EXECUTION_CONTEXT__ACTIVE_STATES) {
-				fireChangeEvent(DebugEvent.CONTENT);
-			}
-			super.notifyChanged(notification);
-		}
-	}
-
 	public boolean canStepInto() {
 		// Not used
 		return false;

+ 0 - 140
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/debugmodel/SCTDebugThread.java

@@ -1,140 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU 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
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.simulation.core.debugmodel;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.emf.ecore.EObject;
-import org.yakindu.base.base.NamedElement;
-import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class SCTDebugThread extends SCTDebugElement implements IThread {
-
-	private final NamedElement element;
-	private ISimulationEngine container;
-
-	public SCTDebugThread(SCTDebugTarget target, ISimulationEngine container, String resourceString,
-			NamedElement element) {
-		super(target, resourceString);
-		Assert.isNotNull(element);
-		this.container = container;
-		this.element = element;
-	}
-
-	@Override
-	public IStackFrame[] getStackFrames() throws DebugException {
-		return null;
-	}
-
-	public int getPriority() throws DebugException {
-		return 0;
-	}
-
-	public boolean hasStackFrames() throws DebugException {
-		return false;
-	}
-
-	public String getName() throws DebugException {
-		return fullQfn(element);
-	}
-
-	public IBreakpoint[] getBreakpoints() {
-		return new IBreakpoint[0];
-	}
-
-	public boolean canResume() {
-		return getDebugTarget().canResume();
-	}
-
-	public boolean canSuspend() {
-		return getDebugTarget().canSuspend();
-	}
-
-	public boolean isSuspended() {
-		return getDebugTarget().isSuspended();
-	}
-
-	public void resume() throws DebugException {
-		getDebugTarget().resume();
-	}
-
-	public void suspend() throws DebugException {
-		getDebugTarget().suspend();
-	}
-
-	public boolean canStepInto() {
-		return false;
-	}
-
-	public boolean canStepOver() {
-		return getDebugTarget().canStepOver();
-	}
-
-	public boolean canStepReturn() {
-		return false;
-	}
-
-	public boolean isStepping() {
-		return getDebugTarget().isStepping();
-	}
-
-	public void stepInto() throws DebugException {
-	}
-
-	public void stepOver() throws DebugException {
-		getDebugTarget().stepOver();
-	}
-
-	public void stepReturn() throws DebugException {
-	}
-
-	public boolean canTerminate() {
-		return getDebugTarget().canTerminate();
-	}
-
-	public boolean isTerminated() {
-		return getDebugTarget().isTerminated();
-	}
-
-	public void terminate() throws DebugException {
-		getDebugTarget().terminate();
-	}
-
-	public IStackFrame getTopStackFrame() throws DebugException {
-		return null;
-	}
-
-	@SuppressWarnings("unchecked")
-	public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
-		if (adapter == ISimulationEngine.class)
-			return container;
-		if (adapter == EObject.class)
-			return element;
-		return super.getAdapter(adapter);
-	}
-
-	public SCTDebugTarget getDebugTarget() {
-		return (SCTDebugTarget) super.getDebugTarget();
-	}
-
-	public NamedElement getElement() {
-		return element;
-	}
-
-}