Java 类org.eclipse.debug.core.IDebugEventSetListener 实例源码

项目:gwt-eclipse-plugin    文件:GwtWtpPlugin.java   
/**
 * When a Server runtime server is started and terminated, and the project has a GWT Facet, start and stop the GWT
 * Super Dev Mode Code Server with runtime server.
 */
@Override
public void start(BundleContext context) throws Exception {
  super.start(context);

  // Observe launch events that are from the WTP server
  serverProcessListener = new IDebugEventSetListener() {
    @Override
    public void handleDebugEvents(DebugEvent[] events) {
      if (events != null) {
        onDebugEvents(events);
      }
    }
  };
  DebugPlugin.getDefault().addDebugEventListener(serverProcessListener);
}
项目:wildfly-hive    文件:WildFlySwarmLaunchConfiguration.java   
protected void stopServer(ControllableServerBehavior behavior) {
    behavior.setServerStopped();
    IDebugEventSetListener terminateListener = (IDebugEventSetListener) behavior.getSharedData(TERMINATE_LISTENER);
    if (terminateListener != null) {
        DebugPlugin.getDefault().removeDebugEventListener(terminateListener);
        behavior.putSharedData(TERMINATE_LISTENER, null);
    }
}
项目:karaf-eik    文件:KarafMBeanProviderWorkbenchService.java   
/**
 * Registers an event listener on the debug session that responds to
 * {@link DebugEvent.TERMINATE} events. This will stop the MBBean connection
 * job, the {@link RuntimeDataProvider} and the {@link MBeanProvider}<br>
 * <br>
 * This will also cleanup the services registered during this debug session.
 *
 * @param launch
 *            the launch process
 */
private IDebugEventSetListener getDebugEventListener(final ILaunch launch) throws CoreException {
    final IProcess process = launch.getProcesses()[0];

    final String memento =
        launch.getLaunchConfiguration().getMemento();

    return new IDebugEventSetListener() {
        @Override
        public void handleDebugEvents(final DebugEvent[] events) {
            if (events == null) {
                return;
            }

            for (final DebugEvent event : events) {
                if (   process != null
                    && process.equals(event.getSource())
                    && event.getKind() == DebugEvent.TERMINATE)
                {
                    final JMXServiceDescriptor descriptor = mbeanProviderDataMap.get(memento).getJmxServiceDescriptor();
                    jmxServiceManager.remove(descriptor);

                    final MBeanServerConnectionJob job = mbeanProviderDataMap.get(memento).getMBeanServerConnectionJob();
                    if (job != null) {
                        job.cancel();
                    }

                    final RuntimeDataProvider runtimeDataProvider = mbeanProviderDataMap.get(memento).getRuntimeDataProvider();
                    runtimeDataProviderManager.remove(runtimeDataProvider);
                    if (runtimeDataProvider != null) {
                        runtimeDataProvider.stop();
                    }

                    final MBeanProvider mbeanProvider = mbeanProviderDataMap.get(memento).getMbeanProvider();
                    mbeanProviderManager.remove(mbeanProvider);

                    if (mbeanProvider != null) {
                        mbeanProvider.close();
                    }
                }
            }
        }
    };
}
项目:Pydev    文件:DebugEarlyStartup.java   
@Override
public void earlyStartup() {
    //Note: preferences are in the PydevPlugin, not in the debug plugin.
    IPreferenceStore preferenceStore = PydevPlugin.getDefault().getPreferenceStore();
    preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (DebugPluginPrefsInitializer.DEBUG_SERVER_STARTUP.equals(event.getProperty())) {
                //On a change in the preferences, re-check if it should be always on...
                checkAlwaysOnJob.schedule(200);
            }
        }
    });

    RemoteDebuggerServer.getInstance().addListener(new IRemoteDebuggerListener() {

        @Override
        public void stopped(RemoteDebuggerServer remoteDebuggerServer) {
            //When it stops, re-check if it should be always on.
            checkAlwaysOnJob.schedule(200);
        }
    });
    checkAlwaysOnJob.schedule(500); //wait a little bit more to enable on startup.

    DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener() {

        @Override
        public void handleDebugEvents(DebugEvent[] events) {
            if (events != null) {
                for (DebugEvent debugEvent : events) {
                    if (debugEvent.getKind() == DebugEvent.SUSPEND) {
                        if (debugEvent.getDetail() == DebugEvent.BREAKPOINT) {
                            if (debugEvent.getSource() instanceof PyThread) {

                                IPreferenceStore preferenceStore2 = PydevPlugin.getDefault().getPreferenceStore();
                                final int forceOption = preferenceStore2
                                        .getInt(DebugPluginPrefsInitializer.FORCE_SHOW_SHELL_ON_BREAKPOINT);

                                if (forceOption != DebugPluginPrefsInitializer.FORCE_SHOW_SHELL_ON_BREAKPOINT_MAKE_NOTHING) {
                                    Runnable r = new Runnable() {

                                        @Override
                                        public void run() {
                                            Shell activeShell = UIUtils.getActiveShell();
                                            if (activeShell != null) {
                                                forceActive(activeShell, forceOption);
                                            }
                                        }
                                    };
                                    boolean runNowIfInUiThread = true;
                                    RunInUiThread.async(r, runNowIfInUiThread);
                                }
                            }
                        }
                    }
                }
            }
        }
    });
}