Java Code Examples for org.eclipse.debug.core.DebugEvent#TERMINATE

The following examples show how to use org.eclipse.debug.core.DebugEvent#TERMINATE . 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: DerbyServerUtils.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void handleDebugEvents(DebugEvent[] events) {
 	// type of event was a terminate...
 	if(events.length>0){
if (events[0].getKind() == DebugEvent.TERMINATE) {
	Object source = events[0].getSource();
	if (source instanceof IProcess) {
		// check for Derby Network Servre process.
		Object proj = servers.get(source);
		if (proj != null) {
			try {
				//remove it from the hashmap, update the ui
				servers.remove(source);
				if(proj instanceof IJavaProject){
					setRunning(((IJavaProject)proj).getProject(), null);
				}else if(proj instanceof IProject){
					setRunning((IProject)proj,null);
				}
			}
			catch (CoreException ce) {
				Logger.log("DerbyServerTracker.handleDebugEvents: "+ce, IStatus.ERROR);
			}catch(Exception e){
				Logger.log("DerbyServerTracker.handleDebugEvents: "+e, IStatus.ERROR);
			}
		}
	}
}
 	}
 }
 
Example 5
Source File: DerbyServerUtils.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void handleDebugEvents(DebugEvent[] events) {
 	// type of event was a terminate...
 	if(events.length>0){
if (events[0].getKind() == DebugEvent.TERMINATE) {
	Object source = events[0].getSource();
	if (source instanceof IProcess) {
		// check for Derby Network Servre process.
		Object proj = servers.get(source);
		if (proj != null) {
			try {
				//remove it from the hashmap, update the ui
				servers.remove(source);
				if(proj instanceof IJavaProject){
					setRunning(((IJavaProject)proj).getProject(), null);
				}else if(proj instanceof IProject){
					setRunning((IProject)proj,null);
				}
			}
			catch (CoreException ce) {
				Logger.log("DerbyServerTracker.handleDebugEvents: "+ce, IStatus.ERROR);
			}catch(Exception e){
				Logger.log("DerbyServerTracker.handleDebugEvents: "+e, IStatus.ERROR);
			}
		}
	}
}
 	}
 }
 
Example 6
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 7
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 8
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 9
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 10
Source File: VoiceXMLBrowserProcess.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void terminate() throws DebugException {
    if (running) {
        if (browser != null) {
            browser.stop();
        }
        running = false;
        DebugEvent[] eventSet = new DebugEvent[2];
        eventSet[0] = new DebugEvent(this, DebugEvent.TERMINATE);
        eventSet[1] = new DebugEvent(launch, DebugEvent.CHANGE);
        DebugPlugin.getDefault().fireDebugEventSet(eventSet);
    }
}
 
Example 11
Source File: JVoiceXmlBrowser.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void stop() {
    if (browserProcess == null) {
        return;
    }

    if (textServer != null) {
        textServer.stopServer();
    }

    final JVoiceXmlPlugin plugin = JVoiceXmlPlugin.getDefault();
    final LoggingReceiver receiver = plugin.getReceiver();
    receiver.close();
    receiver.setBrowser(null);

    try {
        if (session != null) {
            logMessage("stopping session...");
            session.hangup();
            session = null;
            logMessage("session closed");
        }
    } catch (Exception e) {
        logMessage(e.getMessage());
    } finally {
        final DebugEvent event[] = new DebugEvent[2];
        event[0] = new DebugEvent(browserProcess, DebugEvent.TERMINATE);
        event[1] = new DebugEvent(browserProcess.getLaunch(),
                DebugEvent.CHANGE);
        DebugPlugin.getDefault().fireDebugEventSet(event);

        browserProcess.setTerminated(true);
    }
}
 
Example 12
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);
  }
}