@Override
  public void setupLaunchConfiguration(
      ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {

    super.setupLaunchConfiguration(workingCopy, monitor);

    workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, "UTF-8"); // $NON-NLS-1$

    String existingVMArgs =
        workingCopy.getAttribute(
            IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, (String) null);

    if (null != existingVMArgs) {
      String[] parsedVMArgs = DebugPlugin.parseArguments(existingVMArgs);

      List<String> memoryArgs = new ArrayList<String>();

      if (!CoreUtil.isNullOrEmpty(parsedVMArgs)) {
        for (String pArg : parsedVMArgs) {
          if (pArg.startsWith("-Xm") || pArg.startsWith("-XX:")) // $NON-NLS-1$ //$NON-NLS-2$
          {
            memoryArgs.add(pArg);
          }
        }
      }

      String argsWithoutMem =
          mergeArguments(
              existingVMArgs, getRuntimeVMArguments(), memoryArgs.toArray(new String[0]), false);
      String fixedArgs = mergeArguments(argsWithoutMem, getRuntimeVMArguments(), null, false);

      workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, fixedArgs);
    }
  }
 @Override
 protected void publishModules(
     int kind, List modules, List deltaKind2, MultiStatus multi, IProgressMonitor monitor) {
   super.publishModules(
       kind, (redeployModules == null) ? modules : redeployModules, deltaKind2, multi, monitor);
 }
  @Override
  protected void publishFinish(IProgressMonitor monitor) throws CoreException {
    super.publishFinish(monitor);

    this.redeployModules = null;
  }