Java Code Examples for org.eclipse.debug.core.DebugEvent#getKind()

The following examples show how to use org.eclipse.debug.core.DebugEvent#getKind() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugPluginListener.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public void handleDebugEvents(DebugEvent[] events) {
	for (DebugEvent event : events) {
		Object source = event.getSource();
		if (source instanceof IJavaThread)
			synchronized (this) {
				lastThread = (IJavaThread) source;
			}
		else if (source instanceof IStackFrame)
			synchronized (this) {
				lastFrame = (IStackFrame) source;
			}
		else if (source instanceof IDebugTarget)
			synchronized (this) {
				if (event.getKind() == DebugEvent.TERMINATE) {
					if (lastThread != null && lastThread.getDebugTarget() == source)
						lastThread = null;
					if (lastFrame != null && lastFrame.getDebugTarget() == source)
						lastFrame = null;
				}
			}
	}
}
 
Example 2
Source File: SimulationView.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void handleDebugEvent(DebugEvent debugEvent) {
	updateActions();
	switch (debugEvent.getKind()) {
	case DebugEvent.TERMINATE:
		setExecutionContextInput(null);
		Display.getDefault().asyncExec(() -> {
			sessionViewerInputChanged(null);
			if (clock != null && !clock.isDisposed()) {
				clock.updateTimestamp(0);
			}
		});
		raiseEventThreadGroup.interrupt();
		break;
	case DebugEvent.SUSPEND:
		Display.getDefault().asyncExec(() -> {
			simulationSessionViewer.refresh();
		});
		break;
	case DebugEvent.RESUME:
		Display.getDefault().asyncExec(() -> {
			simulationSessionViewer.refresh();
		});
		break;
	}
}
 
Example 3
Source File: XpectConfigurationDelegate.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleDebugEvents(DebugEvent[] events) {
	for (DebugEvent e : events) {
		switch (e.getKind()) {
		case DebugEvent.TERMINATE:
			DebugPlugin.getDefault().removeDebugEventListener(this);
			terminateProcess();
			break;
		default:
			break;
		}
	}
}
 
Example 4
Source File: SCTPerspectiveManager.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void handleDebugEvents(DebugEvent[] events) {
	for (DebugEvent debugEvent : events) {
		if ((debugEvent.getSource().getClass().equals(SCTDebugTarget.class)))
			switch (debugEvent.getKind()) {
				case DebugEvent.TERMINATE :
					if (allTargetsTerminated())
						schedulePerspectiveSwitchJob(ID_PERSPECTIVE_SCT_MODELING);
					break;
				case DebugEvent.SUSPEND :
					break;
				case DebugEvent.RESUME :
					break;
			}
	}
}
 
Example 5
Source File: HighlightingSubmachineDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void handleDebugEvent(DebugEvent debugEvent) {
	switch (debugEvent.getKind()) {
	case DebugEvent.TERMINATE:
		Display.getDefault().asyncExec(new Runnable() {
			public void run() {
				debugTarget = null;
			}
		});
		break;
	case DebugEvent.SUSPEND:
		break;
	case DebugEvent.RESUME:
		break;
	}
}
 
Example 6
Source File: SCTSourceDisplay.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleDebugEvents(DebugEvent[] events) {
	for (DebugEvent event : events) {
		if (event.getKind() == DebugEvent.TERMINATE) {
			handleDebugTargetTerminated(event);
		}
	}
}
 
Example 7
Source File: SCTHotModelReplacementManager.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void handleDebugEvents(DebugEvent[] events) {
	for (DebugEvent debugEvent : events) {
		if (debugEvent.getKind() == DebugEvent.TERMINATE) {
			Object source = debugEvent.getSource();
			if (source instanceof IAdaptable) {
				Object adapter = ((IAdaptable) source).getAdapter(IDebugTarget.class);
				if (adapter instanceof SCTDebugTarget) {
					unregisterSCTTarget((SCTDebugTarget) adapter);
				}
			}
		}
	}
}
 
Example 8
Source File: GwtWtpPlugin.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Start or stop processes automatically. Start or stop the CodeServer.
 */
private void onDebugEvent(DebugEvent event) throws CoreException {
  if (!(event.getSource() instanceof IProcess)) {
    return;
  }

  IProcess runtimeProcess = (IProcess) event.getSource();
  ILaunch launch = runtimeProcess.getLaunch();
  ILaunchConfiguration launchConfig = launch.getLaunchConfiguration();
  if (launchConfig == null) {
    return;
  }

  IServer server = getServerFromLaunchConfig(launch);
  ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
  ILaunchConfigurationType sdmCodeServerType = launchManager
      .getLaunchConfigurationType(GwtSuperDevModeLaunchConfiguration.TYPE_ID);

  if (launchConfig.getType().equals(sdmCodeServerType)) {
    if (event.getKind() == DebugEvent.CREATE) {
      onAfterCodeServerStarted(event);
    } else if (event.getKind() == DebugEvent.TERMINATE) {
      onAfterCodeServerTerminated(event);
    }
  }

  // pass along the event to server started.
  if (server != null && server.getServerState() == IServer.STATE_STARTING) {
    debugEvent = event;
    startedCodeServer = false; // safety reset
  }

  // WTP Server Start/Stop
  if (server != null && serverListener == null) { // listen for server started. It throws two events...
    serverListener = new IServerListener() {
      @Override
      public void serverChanged(ServerEvent event) {
        if (event.getState() == IServer.STATE_STARTED && !startedCodeServer) {
          startedCodeServer = true;
          onServerStarted(debugEvent);
        }
      }
    };
    server.addServerListener(serverListener);
  }

  if (server != null
      && (server.getServerState() == IServer.STATE_STOPPING || server.getServerState() == IServer.STATE_STOPPED)) {
    // Server Stop: Delineate event for Server Launching and then possibly terminate SDM
    onServerStopped(event);
    serverListener = null;
    startedCodeServer = false;

    onAfterWebServerTerminated(event);
  }
}