/**
  * Updates the favorites selections from the local configuration
  *
  * @param config the local configuration
  */
 private void updateFavoritesFromConfig(ILaunchConfiguration config) {
   fFavoritesTable.setInput(config);
   fFavoritesTable.setCheckedElements(new Object[] {});
   try {
     List groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList());
     if (groups.isEmpty()) {
       // check old attributes for backwards compatible
       if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) {
         groups.add(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
       }
       if (config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false)) {
         groups.add(IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
       }
     }
     if (!groups.isEmpty()) {
       List list = new ArrayList();
       Iterator iterator = groups.iterator();
       while (iterator.hasNext()) {
         String id = (String) iterator.next();
         LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id);
         if (extension != null) {
           list.add(extension);
         }
       }
       fFavoritesTable.setCheckedElements(list.toArray());
     }
   } catch (CoreException e) {
     LaunchPlugin.log(e);
   }
 }
  public void initializeFrom(ILaunchConfiguration configuration) {
    try {
      // Port
      int port =
          configuration.getAttribute(ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_PORT, -1);

      setPort(port != -1 ? port : DEFAULT_PORT);

      // Session id
      String sessionId =
          configuration.getAttribute(
              ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_SESSION_ID, (String) null);

      setSessionId(sessionId != null ? sessionId : DEFAULT_SESSION_ID);

      // Timeout
      int timeout =
          configuration.getAttribute(
              ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_WAITING_TIMEOUT,
              DLTKDebugPlugin.getConnectionTimeout());
      setTimeout(timeout);
    } catch (CoreException e) {
      // TODO: Log this
    }
  }
Exemple #3
0
 private void setValuesFrom(Object object) throws CoreException {
   if (object instanceof IPreferenceStore) {
     IPreferenceStore preferences = (IPreferenceStore) object;
     suspendOnFirstLine.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_FIRST_LINE));
     suspendOnExceptions.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_EXCEPTIONS));
     suspendOnErrors.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_ERRORS));
     suspendOnDebuggerKeyword.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_DEBUGGER_KEYWORD));
   } else if (object instanceof ILaunchConfiguration) {
     ILaunchConfiguration configuration = (ILaunchConfiguration) object;
     suspendOnFirstLine.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_FIRST_LINE, false));
     suspendOnExceptions.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_EXCEPTIONS, false));
     suspendOnErrors.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_ERRORS, false));
     suspendOnDebuggerKeyword.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_DEBUGGER_KEYWORDS, false));
   }
 }
  /**
   * Get environment to append
   *
   * @param configuration
   * @return
   * @throws CoreException
   * @since 3.0
   */
  protected static String[] getEnvironment(ILaunchConfiguration configuration)
      throws CoreException {
    Map<?, ?> defaultEnv = null;
    Map<?, ?> configEnv =
        configuration.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, defaultEnv);
    if (configEnv == null) {
      return null;
    }
    if (!configuration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true)) {
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              RMCorePlugin.getUniqueIdentifier(),
              Messages.AbstractToolRuntimeSystem_EnvNotSupported));
    }

    List<String> strings = new ArrayList<String>(configEnv.size());
    Iterator<?> iter = configEnv.entrySet().iterator();
    while (iter.hasNext()) {
      Entry<?, ?> entry = (Entry<?, ?>) iter.next();
      String key = (String) entry.getKey();
      String value = (String) entry.getValue();
      strings.add(key + "=" + value); // $NON-NLS-1$
    }
    return strings.toArray(new String[strings.size()]);
  }
  public static List<LaunchConfigData> getProjectLaunchConfigs(final IProject project) {
    List<LaunchConfigData> matches = new LinkedList<>();

    try {
      ILaunchConfiguration[] configs =
          DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();

      for (ILaunchConfiguration launchConfig : configs) {
        String launchConfigProjectName =
            launchConfig.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_PROJECT, "");

        if (launchConfigProjectName != null
            && !launchConfigProjectName.equals("")
            && launchConfigProjectName.equals(project.getName())) {
          String exp = launchConfig.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_EXPRESSION, "");
          matches.add(new LaunchConfigData(launchConfig.getName(), exp));
        }
      }
    } catch (CoreException e) {

      CodeGenConsole.GetInstance()
          .printErrorln(
              "Problem looking up launch configurations for project "
                  + project.getName()
                  + ": "
                  + e.getMessage());
      e.printStackTrace();
    }

    return matches;
  }
 /** @since 2.0 */
 protected void updateCoreFromConfig(ILaunchConfiguration config) {
   if (fCoreText != null) {
     String coreName = EMPTY_STRING;
     String coreType = IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TYPE_DEFAULT;
     try {
       coreName =
           config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING);
       coreType =
           config.getAttribute(
               IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE,
               IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TYPE_DEFAULT);
     } catch (CoreException ce) {
       GdbUIPlugin.log(ce);
     }
     fCoreText.setText(coreName);
     if (coreType.equals(IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_CORE_FILE)) {
       fCoreTypeCombo.setText(CORE_FILE);
     } else if (coreType.equals(
         IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE)) {
       fCoreTypeCombo.setText(TRACE_FILE);
     } else {
       assert false : "Unknown core file type"; // $NON-NLS-1$
       fCoreTypeCombo.setText(CORE_FILE);
     }
     updateCoreFileLabel();
   }
 }
 protected void initializeServerControl(ILaunchConfiguration configuration) {
   try {
     String serverName = configuration.getAttribute(Server.NAME, ""); // $NON-NLS-1$
     if (serverName != null && !serverName.equals("")) { // $NON-NLS-1$
       server = ServersManager.getServer(serverName);
       if (server == null) { // server no longer exists
         setErrorMessage(
             PHPServerUIMessages.getString("ServerTab.invalidServerError")); // $NON-NLS-1$
         selectDefaultServer(configuration);
       } else {
         serverCombo.setText(server.getName());
       }
     } else {
       selectDefaultServer(configuration);
     }
     // flag should only be set if launch has been attempted on the
     // config
     if (configuration.getAttribute(READ_ONLY, false)) {
       serverCombo.setEnabled(false);
     }
     boolean enabled = configuration.getAttribute(SERVER_ENABLED, true);
     serverCombo.setEnabled(enabled);
     createNewServer.setEnabled(enabled);
   } catch (Exception e) {
   }
 }
 public static IVMInstall getVMInstall(ILaunchConfiguration configuration) throws CoreException {
   String jre =
       configuration.getAttribute(
           IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String) null);
   IVMInstall vm = null;
   if (jre == null) {
     String name = configuration.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null);
     if (name == null) {
       name = getDefaultVMInstallName(configuration);
     }
     vm = getVMInstall(name);
     if (vm == null) {
       throw new CoreException(
           LauncherUtils.createErrorStatus(
               NLS.bind(MDEMessages.WorkbenchLauncherConfigurationDelegate_noJRE, name)));
     }
   } else {
     IPath jrePath = Path.fromPortableString(jre);
     vm = JavaRuntime.getVMInstall(jrePath);
     if (vm == null) {
       String id = JavaRuntime.getExecutionEnvironmentId(jrePath);
       if (id == null) {
         String name = JavaRuntime.getVMInstallName(jrePath);
         throw new CoreException(
             LauncherUtils.createErrorStatus(
                 NLS.bind(MDEMessages.WorkbenchLauncherConfigurationDelegate_noJRE, name)));
       }
       throw new CoreException(
           LauncherUtils.createErrorStatus(NLS.bind(MDEMessages.VMHelper_cannotFindExecEnv, id)));
     }
   }
   return vm;
 }
  /*
   * Expands and returns the location attribute of the given launch configuration. The location is verified to point
   * to an existing file, in the local file system.
   *
   * @param configuration launch configuration
   *
   * @return an absolute path to a file in the local file system
   *
   * @throws CoreException if unable to retrieve the associated launch configuration attribute, if unable to resolve
   * any variables, or if the resolved location does not point to an existing file in the local file system
   */
  public static IPath[] getLocation(ILaunchConfiguration configuration, IPythonNature nature)
      throws CoreException {
    String locationsStr =
        configuration.getAttribute(Constants.ATTR_ALTERNATE_LOCATION, (String) null);
    if (locationsStr == null) {
      locationsStr = configuration.getAttribute(Constants.ATTR_LOCATION, (String) null);
    }
    if (locationsStr == null) {
      throw new CoreException(
          PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unable to get location for run", null));
    }

    List<String> locations = StringUtils.splitAndRemoveEmptyTrimmed(locationsStr, '|');
    Path[] ret = new Path[locations.size()];
    int i = 0;
    for (String location : locations) {
      String expandedLocation = getStringSubstitution(nature).performStringSubstitution(location);
      if (expandedLocation == null || expandedLocation.length() == 0) {
        throw new CoreException(
            PydevDebugPlugin.makeStatus(
                IStatus.ERROR, "Unable to get expanded location for run", null));
      } else {
        ret[i] = new Path(expandedLocation);
      }
      i++;
    }
    return ret;
  }
  public IDockerHostConfig getDockerHostConfig(ILaunchConfiguration config) throws CoreException {

    final DockerHostConfig.Builder hostConfigBuilder = new DockerHostConfig.Builder();
    if (config.getAttribute(IRunDockerImageLaunchConfigurationConstants.PUBLISH_ALL_PORTS, false)) {
      hostConfigBuilder.publishAllPorts(true);
    } else {
      final Map<String, List<IDockerPortBinding>> portBindings = new HashMap<>();
      Map<String, String> ports =
          config.getAttribute(
              IRunDockerImageLaunchConfigurationConstants.PUBLISHED_PORTS,
              new HashMap<String, String>());
      for (Map.Entry<String, String> entry : ports.entrySet()) {
        String key = entry.getKey();
        String entryValue = entry.getValue();

        String[] portPairs = entryValue.split("\\s*,\\s*"); // $NON-NLS-1$

        for (int i = 0; i < portPairs.length; i += 2) {
          DockerPortBinding portBinding = new DockerPortBinding(portPairs[i], portPairs[i + 1]);
          portBindings.put(key, Arrays.<IDockerPortBinding>asList(portBinding));
        }
      }
      hostConfigBuilder.portBindings(portBindings);
    }
    // container links
    final List<String> links =
        config.getAttribute(
            IRunDockerImageLaunchConfigurationConstants.LINKS, new ArrayList<String>());
    hostConfigBuilder.links(links);

    // data volumes

    List<String> volumesFromList =
        config.getAttribute(
            IRunDockerImageLaunchConfigurationConstants.VOLUMES_FROM, new ArrayList<String>());
    hostConfigBuilder.volumesFrom(volumesFromList);

    final List<String> binds = new ArrayList<>();

    List<String> bindsList =
        config.getAttribute(
            IRunDockerImageLaunchConfigurationConstants.BINDS, new ArrayList<String>());

    for (String bindsListEntry : bindsList) {
      String[] bindsEntryParms = bindsListEntry.split(":"); // $NON-NLS-1$
      String bind =
          LaunchConfigurationUtils.convertToUnixPath(bindsEntryParms[0])
              + ':'
              + bindsEntryParms[1]
              + ':'
              + 'Z';
      if (bindsEntryParms[2].equals("true")) {
        bind += ",ro"; // $NON-NLS-1$
      }
      binds.add(bind);
    }
    hostConfigBuilder.binds(binds);

    return hostConfigBuilder.build();
  }
Exemple #11
0
 protected void initProject(ILaunchConfiguration configuration) throws CoreException {
   String name =
       configuration.getAttribute(RUNCONFIG_PROJECT_NAME_ATTRIBUTE, getDefaultProjectName());
   fillProjectDropDownMenue(name);
   name = configuration.getAttribute(RUNCONFIG_PRODUCT_NAME_ATTRIBUTE, (String) null);
   fillProductDropDownMenue(name);
   updateErrors();
 }
Exemple #12
0
 private boolean configEquals(final ILaunchConfiguration a) throws CoreException {
   return opsFile.equals(
           a.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "X"))
       && MigDbLauncher.class
           .getName()
           .equals(a.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "X"))
       && project.equals(
           a.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "X"))
       && a.getType().getIdentifier().equals("migdb.dsl.ide.launch.OpsLaunchConfigurationType");
 }
Exemple #13
0
  /**
   * Gets the CDT environment from the CDT project's configuration referenced by the launch
   *
   * @since 3.0
   */
  public static String[] getLaunchEnvironment(ILaunchConfiguration config) throws CoreException {
    // Get the project
    String projectName =
        config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
    if (projectName == null) {
      return null;
    }
    projectName = projectName.trim();
    if (projectName.length() == 0) {
      return null;
    }
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    if (project == null || !project.isAccessible()) return null;

    ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project, false);

    // Not a CDT project?
    if (projDesc == null) return null;

    String buildConfigID =
        config.getAttribute(
            ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); // $NON-NLS-1$
    ICConfigurationDescription cfg = null;
    if (buildConfigID.length() != 0) cfg = projDesc.getConfigurationById(buildConfigID);

    // if configuration is null fall-back to active
    if (cfg == null) cfg = projDesc.getActiveConfiguration();

    // Environment variables and inherited vars
    HashMap<String, String> envMap = new HashMap<String, String>();
    IEnvironmentVariable[] vars =
        CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cfg, true);
    for (IEnvironmentVariable var : vars) envMap.put(var.getName(), var.getValue());

    // Add variables from build info
    ICdtVariable[] build_vars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg);
    for (ICdtVariable var : build_vars) {
      try {
        envMap.put(var.getName(), var.getStringValue());
      } catch (CdtVariableException e) {
        // Some Eclipse dynamic variables can't be resolved dynamically... we don't care.
      }
    }

    // Turn it into an envp format
    List<String> strings = new ArrayList<String>(envMap.size());
    for (Entry<String, String> entry : envMap.entrySet()) {
      StringBuffer buffer = new StringBuffer(entry.getKey());
      buffer.append('=').append(entry.getValue());
      strings.add(buffer.toString());
    }

    return strings.toArray(new String[strings.size()]);
  }
  private static boolean isSupported(ILaunchConfiguration launch, String projectname)
      throws CoreException {
    String currentProjectName =
        launch.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
    if (!currentProjectName.equals(projectname)) return false;

    if ("".equals(launch.getAttribute(Plugin.ATTR_CONTEXT, ""))) return false;

    if ("".equals(launch.getAttribute(Plugin.ATTR_WEBAPPDIR, ""))) return false;

    return true;
  }
  @Override
  public boolean isValid(ILaunchConfiguration launchConfig) {
    setErrorMessage(null);

    boolean result = false;
    try {
      // check alignment
      int alignment =
          launchConfig.getAttribute(
              MemcheckLaunchConstants.ATTR_MEMCHECK_ALIGNMENT_VAL,
              MemcheckLaunchConstants.DEFAULT_MEMCHECK_ALIGNMENT_VAL);
      result = (alignment & (alignment - 1)) == 0; // is power of two?
      if (!result) {
        setErrorMessage(
            Messages.getString("MemcheckToolPage.Alignment_must_be_power_2")); // $NON-NLS-1$
      } else {
        // VG >= 3.4.0
        if (valgrindVersion == null || valgrindVersion.compareTo(VER_3_4_0) >= 0) {
          // check track-origins
          boolean trackOrigins =
              launchConfig.getAttribute(
                  MemcheckLaunchConstants.ATTR_MEMCHECK_TRACKORIGINS,
                  MemcheckLaunchConstants.DEFAULT_MEMCHECK_TRACKORIGINS);
          if (trackOrigins) {
            // undef-value-errors must be selected
            result =
                launchConfig.getAttribute(
                    MemcheckLaunchConstants.ATTR_MEMCHECK_UNDEF,
                    MemcheckLaunchConstants.DEFAULT_MEMCHECK_UNDEF);
            if (!result) {
              setErrorMessage(
                  NLS.bind(
                      Messages.getString("MemcheckToolPage.Track_origins_needs_undef"),
                      Messages.getString("MemcheckToolPage.Track_origins"),
                      Messages.getString(
                          "MemcheckToolPage.undef_value_errors"))); //$NON-NLS-1$ //$NON-NLS-2$
              // //$NON-NLS-3$
            }
          }
        }
      }
    } catch (CoreException e) {
      ex = e;
    }

    if (ex != null) {
      setErrorMessage(ex.getLocalizedMessage());
    }
    return result;
  }
 public void initializeFrom(ILaunchConfiguration configuration) {
   try {
     mapperClass.setText(
         configuration.getAttribute("org.apache.hadoop.eclipse.launch.mapper", ""));
     reducerClass.setText(
         configuration.getAttribute("org.apache.hadoop.eclipse.launch.reducer", ""));
     combinerClass.setText(
         configuration.getAttribute("org.apache.hadoop.eclipse.launch.combiner", ""));
   } catch (CoreException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     setErrorMessage(e.getMessage());
   }
 }
  /** cli Comment method "removeJobLaunch". */
  public static void removeJobLaunch(IRepositoryViewObject objToDelete) {
    if (objToDelete == null) {
      return;
    }
    Property property = objToDelete.getProperty();
    if (property == null || !(property.getItem() instanceof ProcessItem)) {
      return;
    }
    Project project = ProjectManager.getInstance().getProject(property);
    if (project == null) {
      return;
    }
    final String objProjectName = project.getLabel();
    final String objId = property.getId();
    // final String objName = property.getLabel();
    final String objVersion = property.getVersion();

    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    if (launchManager == null) {
      return;
    }
    try {
      ILaunchConfiguration configuration = null;
      for (ILaunchConfiguration config : launchManager.getLaunchConfigurations()) {
        String jobId = config.getAttribute(TalendDebugUIConstants.JOB_ID, (String) null);
        // String jobName = configuration.getAttribute(TalendDebugUIConstants.JOB_NAME, (String)
        // null);
        String jobVersion = config.getAttribute(TalendDebugUIConstants.JOB_VERSION, (String) null);
        String projectName =
            config.getAttribute(TalendDebugUIConstants.CURRENT_PROJECT_NAME, (String) null);
        ILaunchConfigurationType type = config.getType();
        if (type != null
            && TalendDebugUIConstants.JOB_DEBUG_LAUNCH_CONFIGURATION_TYPE.equals(
                type.getIdentifier())
            && objProjectName.equals(projectName)
            && objId.equals(jobId)
            && objVersion.equals(jobVersion)) {
          configuration = config;
          break;
        }
      }
      if (configuration == null) {
        return;
      }
      configuration.delete();
    } catch (CoreException e) {
      // nothing to do
    }
  }
 /**
  * Loads the context identifier type from the launch configuration's preference store.
  *
  * @param config - the config to load the agent name from
  */
 protected void updateContextIdentifierTypeFromConfig(ILaunchConfiguration config) {
   RootContextIdentifierType type = RootContextIdentifierType.DEFAULT_CONTEXT_ID;
   try {
     final String typeName =
         config.getAttribute(SARLEclipseConfig.ATTR_ROOT_CONTEXT_ID_TYPE, (String) null);
     if (!Strings.isNullOrEmpty(typeName)) {
       type = RootContextIdentifierType.valueOf(typeName);
     }
   } catch (Exception ce) {
     SARLEclipsePlugin.getDefault().log(ce);
   }
   assert type != null;
   switch (type) {
     case RANDOM_CONTEXT_ID:
       this.randomContextIdentifierButton.setSelection(true);
       break;
     case BOOT_AGENT_CONTEXT_ID:
       this.bootContextIdentifierButton.setSelection(true);
       break;
     case DEFAULT_CONTEXT_ID:
     default:
       this.defaultContextIdentifierButton.setSelection(true);
       break;
   }
 }
Exemple #19
0
 @Override
 public void launch(
     final ILaunchConfiguration configuration,
     String mode,
     ILaunch launch,
     IProgressMonitor monitor)
     throws CoreException {
   final RunletEvaluator main =
       new RunletEvaluator(
           configuration.getAttribute(RunletMainTab.PROJECT_ATTRIBUTE, RunletMainTab.NGPM_STDLIB));
   if (mode.equals("debug")) {
     RunletDebugTarget debugTarget =
         new RunletDebugTarget(main, launch, configuration.getName(), new RunletObjectFormatter());
     launch.addDebugTarget(debugTarget);
     launch.addProcess(debugTarget.getProcess());
     // TODO for testing, request to suspend immediately
     debugTarget.suspend();
     // debugSession.suspend(main.getInterpreter());
   }
   new Thread(mode + " Runlet " + configuration.getName()) {
     public void run() {
       try {
         RunletObject<AssociationEnd, TypeDefinition, ClassTypeDefinition>[] result =
             main.evaluate(
                 configuration.getAttribute(
                     RunletMainTab.EXPRESSION_ATTRIBUTE, "")); // $NON-NLS-1$
         main.getInterpreter().terminate();
         log.info(Messages.LaunchConfig_1 + Arrays.asList(result));
       } catch (Exception e) {
         log.throwing(getClass().getName(), "launch", e); // $NON-NLS-1$
       }
     }
   }.start();
 }
  /** @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput(java.lang.Object) */
  public IEditorInput getEditorInput(Object element) {
    IStorageEditorInput i;
    AtlStackFrame frame;
    //		String projectName;
    String fileName;

    if (element instanceof AtlStackFrame) {
      frame = (AtlStackFrame) element;
      if (((AtlDebugTarget) frame.getDebugTarget()).isDisassemblyMode())
        return getDisassemblyEditorInput(frame);
      ILaunchConfiguration configuration =
          frame.getDebugTarget().getLaunch().getLaunchConfiguration();
      try {
        // TODO Recuperer le nom du fichier sur la stackframe
        fileName =
            configuration.getAttribute(
                AtlLauncherTools.ATLFILENAME, AtlLauncherTools.NULLPARAMETER);

        IWorkspace wks = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot wksroot = wks.getRoot();

        i = new FileEditorInput(wksroot.getFile(new Path(fileName)));
        return i;
      } catch (CoreException e) {
        e.printStackTrace();
      }
    } else if (element instanceof AtlBreakpoint) {
      IMarker marker = ((AtlBreakpoint) element).getMarker();
      IFile ifile = (IFile) marker.getResource();
      return new FileEditorInput(ifile);
    }
    return null;
  }
  /**
   * Looks for and returns all existing Launch Configuration object for a specified project.
   *
   * @param projectName The name of the project
   * @return all the ILaunchConfiguration object. If none are present, an empty array is returned.
   */
  private static ILaunchConfiguration[] findConfigs(String projectName) {
    // get the launch manager
    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();

    // now get the config type for our particular android type.
    ILaunchConfigurationType configType =
        manager.getLaunchConfigurationType(LaunchConfigDelegate.ANDROID_LAUNCH_TYPE_ID);

    // create a temp list to hold all the valid configs
    ArrayList<ILaunchConfiguration> list = new ArrayList<ILaunchConfiguration>();

    try {
      ILaunchConfiguration[] configs = manager.getLaunchConfigurations(configType);

      for (ILaunchConfiguration config : configs) {
        if (config
            .getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "")
            .equals(projectName)) { // $NON-NLS-1$
          list.add(config);
        }
      }
    } catch (CoreException e) {
    }

    return list.toArray(new ILaunchConfiguration[list.size()]);
  }
 private void updateURLEnabled(ILaunchConfiguration configuration) throws CoreException {
   boolean enabled = configuration.getAttribute(SERVER_ENABLED, true);
   fURLLabel.getParent().setVisible(enabled);
   if (enabled) {
     fURLPath.setEnabled(!autoGeneratedURL.getSelection());
   }
 }
  @SuppressWarnings("deprecation")
  private void launch(IContainer basecon, String mode) {
    if (basecon == null) {
      return;
    }

    IContainer basedir = findPomXmlBasedir(basecon);

    ILaunchConfiguration launchConfiguration = getLaunchConfiguration(basedir, mode);
    if (launchConfiguration == null) {
      return;
    }

    boolean openDialog = showDialog;
    if (!openDialog) {
      try {
        // if no goals specified
        String goals =
            launchConfiguration.getAttribute(MavenLaunchConstants.ATTR_GOALS, (String) null);
        openDialog = goals == null || goals.trim().length() == 0;
      } catch (CoreException ex) {
        log.error(ex.getMessage(), ex);
      }
    }

    if (openDialog) {
      DebugUITools.saveBeforeLaunch();
      // ILaunchGroup group = DebugUITools.getLaunchGroup(launchConfiguration, mode);
      DebugUITools.openLaunchConfigurationDialog(
          getShell(), launchConfiguration, MavenLaunchMainTab.ID_EXTERNAL_TOOLS_LAUNCH_GROUP, null);
    } else {
      DebugUITools.launch(launchConfiguration, mode);
    }
  }
 @Override
 public void moduleLoaded(
     final IBackend backend, final IProject project, final String moduleName) {
   try {
     final ErlangDebugTarget erlangDebugTarget = debugTargetOfBackend(backend.getOtpRpc());
     if (erlangDebugTarget != null
         && erlangDebugTarget.getInterpretedModules().contains(moduleName)) {
       if (isModuleRunningInInterpreter(erlangDebugTarget, backend.getOtpRpc(), moduleName)) {
         abortContinueDialog(erlangDebugTarget);
       } else {
         final ILaunchConfiguration launchConfiguration =
             erlangDebugTarget.getLaunch().getLaunchConfiguration();
         final EnumSet<ErlDebugFlags> debugFlags =
             ErlDebugFlags.makeSet(
                 launchConfiguration.getAttribute(
                     ErlRuntimeAttributes.DEBUG_FLAGS,
                     ErlDebugFlags.getFlag(ErlDebugFlags.DEFAULT_DEBUG_FLAGS)));
         final boolean distributed = debugFlags.contains(ErlDebugFlags.DISTRIBUTED_DEBUG);
         erlangDebugTarget.interpret(project, moduleName, distributed, true);
       }
     }
   } catch (final CoreException e) {
     ErlLogger.error(e);
   }
 }
Exemple #25
0
 private Collection<IProject> getProjects(final ILaunchConfiguration config) throws CoreException {
   String prjs;
   prjs = config.getAttribute(ErlLaunchAttributes.PROJECTS, "");
   final String[] projectNames =
       prjs.length() == 0 ? new String[] {} : prjs.split(PROJECT_NAME_SEPARATOR);
   return gatherProjects(projectNames);
 }
  @Override
  public boolean isValid(ILaunchConfiguration configuration) {
    try {
      if (!configuration.hasAttribute(COLaunchConfigurationDelegate.INPUT_FILE)) {
        setErrorMessage("No input configuration file defined");
        return false;
      }
      // Check input file exists
      File inputFile =
          new File(
              URI.create(
                  configuration.getAttribute(
                      COLaunchConfigurationDelegate.INPUT_FILE, StringUtils.EMPTY)));
      if (!inputFile.isFile()) {
        // Should not happen...
        setErrorMessage("Input file does not exist");
        return false;
      }
    } catch (Exception e) {
      // TODO: handle exception
    }

    setErrorMessage(null);
    return true;
  }
 public void launch(
     ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
     throws CoreException {
   String action = configuration.getAttribute(ACTION_KEY, START);
   DeployableServerBehavior behavior = getServerBehavior(configuration);
   if (START.equals(action)) behavior.setServerStarted();
   if (STOP.equals(action)) behavior.setServerStopped();
 }
 public String getConnectionHost() {
   try {
     return launchConfig.getAttribute(CONNECTION_HOST, "localhost");
   } catch (CoreException e) {
     SDBGDebugCorePlugin.logError(e);
     return "";
   }
 }
 /* (non-Javadoc)
  * @see ca.uvic.chisel.javasketch.launching.ITraceClient#initialize(org.eclipse.debug.core.ILaunchConfiguration)
  */
 @Override
 public final void initialize(ILaunchConfiguration configuration) throws CoreException {
   // this method will set up all the files that we need.
   this.configuration = configuration;
   this.paused = configuration.getAttribute(FilterTab.PAUSE_ON_START, true);
   getFileName();
   doInitialize(configuration);
 }
 public int getConnectionPort() {
   try {
     return launchConfig.getAttribute(CONNECTION_PORT, 9222);
   } catch (CoreException e) {
     SDBGDebugCorePlugin.logError(e);
     return 9222;
   }
 }