Java Code Examples for org.eclipse.debug.core.DebugEvent#getSource()
The following examples show how to use
org.eclipse.debug.core.DebugEvent#getSource() .
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 |
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: GwtWtpPlugin.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void onAfterCodeServerStarted(DebugEvent event) { if (!(event.getSource() instanceof IProcess)) { return; } IProcess runtimeProcess = (IProcess) event.getSource(); final ILaunch launch = runtimeProcess.getLaunch(); IProcess[] processes = launch.getProcesses(); final IProcess process = processes[0]; // Look for the links in the sdm console output consoleStreamListenerCodeServer = new IStreamListener() { @Override public void streamAppended(String text, IStreamMonitor monitor) { displayCodeServerUrlInDevMode(launch, text); } }; // Listen to Console output streamMonitorCodeServer = process.getStreamsProxy().getOutputStreamMonitor(); streamMonitorCodeServer.addListener(consoleStreamListenerCodeServer); }
Example 3
Source File: ModulaEditor.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private boolean isSourceCorrespondsToSameDebugSession(DebugEvent e) { if (e.getSource() instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) e.getSource(); ILaunch launch = (ILaunch)adaptable.getAdapter(ILaunch.class); if (launch != null){ try { IProject iProjectOfLaunch = LaunchConfigurationUtils.getProject(launch.getLaunchConfiguration()); return Objects.equals(getProject(), iProjectOfLaunch); } catch (CoreException err) { LogHelper.logError(err); } } } return false; }
Example 4
Source File: AbstractDebugTargetView.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public final void handleDebugEvents(DebugEvent[] events) { for (DebugEvent debugEvent : events) { // Only notify about events fired from the active debug target if ((debugEvent.getSource() instanceof SCTDebugTarget) && debugEvent.getSource() == debugTarget) handleDebugEvent(debugEvent); } }
Example 5
Source File: SCTSourceDisplay.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void handleDebugTargetTerminated(DebugEvent debugEvent) { Object source = debugEvent.getSource(); if (source instanceof IDebugTarget) { IDebugTarget target = (IDebugTarget) source; if (activeLaunch == target.getLaunch()) { activeLaunch = null; for (IDynamicNotationHandler current : handler.values()) { current.terminate(); } handler.clear(); } } }
Example 6
Source File: SCTHotModelReplacementManager.java From statecharts with Eclipse Public License 1.0 | 5 votes |
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 7
Source File: GwtWtpPlugin.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private void onAfterWebServerStarted(DebugEvent event) { if (!(event.getSource() instanceof IProcess)) { return; } // nothing at the moment }
Example 8
Source File: GwtWtpPlugin.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
/** * 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); } }
Example 9
Source File: GwtWtpPlugin.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
/** * Possibly start the GWT Super Dev Mode CodeServer. <br/> * <br/> * This starts as separate process, which allows for custom args modification. <br/> * It adds a launcher id to both processes for reference. <br/> * 1. Get it from classic launch config <br/> * 2. Get it from server VM properties <br/> */ protected void onServerStarted(DebugEvent event) { onAfterWebServerStarted(event); IProcess runtimeProcess = (IProcess) event.getSource(); ILaunch launch = runtimeProcess.getLaunch(); ILaunchConfiguration launchConfig = launch.getLaunchConfiguration(); String launchMode = launch.getLaunchMode(); IServer server = null; try { server = ServerUtil.getServer(launchConfig); } catch (CoreException e) { logError("possiblyLaunchGwtSuperDevModeCodeServer: Could get the WTP server.", e); return; } if (server == null) { logMessage("possiblyLaunchGwtSuperDevModeCodeServer: No WTP server runtime found."); return; } IFacetedProject gwtFacetedProject = GwtFacetUtils.getGwtFacetedProject(server); // If one of the server modules has a gwt facet if (gwtFacetedProject == null) { logMessage("possiblyLaunchGwtSuperDevModeCodeServer: Does not have a GWT Facet."); return; } // Sync Option - the sync is off, ignore stopping the server if (!GWTProjectProperties.getFacetSyncCodeServer(gwtFacetedProject.getProject())) { logMessage("possiblyLaunchGwtSuperDevModeCodeServer: GWT Facet project properties, the code server sync is off."); return; } /** * Get the war output path for the `-launcherDir` in SDM launcher */ String launcherDir = getLauncherDirectory(server, launchConfig, gwtFacetedProject); // LauncherId used to reference and terminate the the process String launcherId = setLauncherIdToWtpRunTimeLaunchConfig(launchConfig); logMessage("possiblyLaunchGwtSuperDevModeCodeServer: Launching GWT Super Dev Mode CodeServer. launcherId=" + launcherId + " launcherDir=" + launcherDir); // Just in case if (launchMode == null) { // run the code server, no need to debug it launchMode = "run"; } if (launcherId == null) { // ids to link two processes together logMessage("possiblyLaunchGwtSuperDevModeCodeServer: No launcherId."); } // Add server urls to DevMode view for easy clicking on addServerUrlsToDevModeView(launch); // Creates ore launches an existing Super Dev Mode Code Server process GwtSuperDevModeCodeServerLaunchUtil.launch(gwtFacetedProject.getProject(), launchMode, launcherDir, launcherId); }