Examples of IVMConnector


Examples of org.eclipse.jdt.launching.IVMConnector

  public static final String DEBUGGER_CONNECTION_ID = "debuggerconnectionid"; //$NON-NLS-1$

  public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
      throws CoreException {
    // Use default for now
    final IVMConnector connector = JavaRuntime.getDefaultVMConnector();

    // Create the required arguments for the IVMConnector
    final Map<String, String> argMap = new HashMap<String, String>();
    String timeout = configuration.getAttribute(TIME_OUT, (String) null);
    if (timeout != null) {
      argMap.put("timeout", timeout); //$NON-NLS-1$
    }

    String host = configuration.getAttribute(HOST_NAME, (String) null);
    String port = configuration.getAttribute(PORT, (String) null);
    if (host != null && port != null) {
      argMap.put("hostname", host); //$NON-NLS-1$
      argMap.put("port", port); //$NON-NLS-1$

      setSourceLocator(launch);
      connector.connect(argMap, monitor, launch);
      addDebuggerConnectionListener(configuration.getAttribute(DEBUGGER_CONNECTION_ID, (String) null), launch);
    }
    else {
      CloudFoundryPlugin
          .logError("Failed to launch debug configuration. IP and host for application instance cannot be resolved."); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.jdt.launching.IVMConnector

  boolean connectInDebugMode(ILaunch launch, IServer iServer, IProgressMonitor monitor)
      throws CoreException {
    this.launch = launch;
    boolean success = false;
    IVMConnector connector = null;
    connector = JavaRuntime.getVMConnector("org.eclipse.jdt.launching.socketAttachConnector");
    if (connector == null) {
      connector = JavaRuntime.getDefaultVMConnector();
    }
    if (connector == null) {
      throw new CoreException(new Status(IStatus.ERROR, "org.apache.sling.ide.eclipse.wst",
          "Could not get jvm connctor"));
    }
   
    ISlingLaunchpadServer launchpadServer = (ISlingLaunchpadServer) iServer.loadAdapter(SlingLaunchpadServer.class,
            monitor);

    ISlingLaunchpadConfiguration configuration = launchpadServer.getConfiguration();
   
    int debugPort = configuration.getDebugPort();
   
    if (debugPort<=0) {
      throw new CoreException(new Status(IStatus.ERROR, "org.apache.sling.ide.eclipse.wst",
                "debug port not configured"));
    }
   
    Map<String, String> connectMap = new HashMap<String, String>();
    connectMap.put("hostname", iServer.getHost());
    connectMap.put("port", String.valueOf(debugPort));
   
//      Map argMap = null;//configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map)null);
   
    int connectTimeout = JavaRuntime.getPreferences().getInt(JavaRuntime.PREF_CONNECT_TIMEOUT);
    connectMap.put("timeout", Integer.toString(connectTimeout))//$NON-NLS-1$

    // set the default source locator if required
    @SuppressWarnings("restriction")
    ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector();
    sourceLocator
        .setSourcePathComputer(DebugPlugin.getDefault().getLaunchManager()
            .getSourcePathComputer(
                "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); //$NON-NLS-1$
    List<ISourceContainer> l = new LinkedList<ISourceContainer>();
    IJavaProject[] javaProjects = ProjectHelper.getAllJavaProjects();
    if (javaProjects!=null) {
      for (int i = 0; i < javaProjects.length; i++) {
        IJavaProject javaProject = javaProjects[i];
        JavaProjectSourceContainer sc = new JavaProjectSourceContainer(javaProject);
        l.add(sc);
//          ISourceContainer[] scs = sc.getSourceContainers();
//          if (scs!=null && scs.length>0) {
//            for (int j = 0; j < scs.length; j++) {
//              ISourceContainer iSourceContainer = scs[j];
//              l.add(iSourceContainer);
//            }
//          } else {
//          }
      }
      ISourceContainer[] containers = l.toArray(new ISourceContainer[l.size()]);
      sourceLocator.setSourceContainers(containers);
      sourceLocator.initializeParticipants();
//      sourceLocator.initializeDefaults(configuration);
      launch.setSourceLocator(sourceLocator);
    }

//      setDefaultSourceLocator(getServer().getLaunch(), null);
    monitor.worked(1);   
   
    // connect to remote VM
    try{
      connector.connect(connectMap, monitor, launch);
      success = true;
    } catch(Exception e) {
      throw new CoreException(new Status(IStatus.ERROR, "org.apache.sling.ide.eclipse.wst",
                "could not establish debug connection to "+iServer.getHost()+" : "+debugPort, e));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.