org.eclipse.ant.launching_1.0.101.v20120110-1739

16:41:21.529 INFO  jd.cli.Main - Decompiling org.eclipse.ant.launching_1.0.101.v20120110-1739.jar
package org.eclipse.ant.internal.launching;

import org.eclipse.osgi.util.NLS;

public class AntCoreModelMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.launchConfigurations.AntCoreModelMessages";
  public static String AntUtil_6;
  public static String AntUtil_7;
  public static String AntUtil_2;
  
  static
  {
    NLS.initializeMessages("org.eclipse.ant.internal.launching.launchConfigurations.AntCoreModelMessages", AntCoreModelMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.AntCoreModelMessages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.ISourceLocator;

public class AntLaunch
  extends Launch
{
  List linkDescriptors;
  
  public AntLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator)
  {
    super(launchConfiguration, mode, locator);
    linkDescriptors = new ArrayList();
  }
  
  public void addLinkDescriptor(String line, String fileName, int lineNumber, int offset, int length)
  {
    if ((fileName != null) && (fileName.trim().length() > 0)) {
      synchronized (linkDescriptors)
      {
        linkDescriptors.add(new LinkDescriptor(line, fileName, lineNumber, offset, length));
      }
    }
  }
  
  public void removeLinkDescriptor(LinkDescriptor ld)
  {
    synchronized (linkDescriptors)
    {
      linkDescriptors.remove(ld);
    }
  }
  
  /* Error */
  public List getLinkDescriptors()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 59	org/eclipse/ant/internal/launching/AntLaunch:linkDescriptors	Ljava/util/List;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: new 31	java/util/ArrayList
    //   10: dup
    //   11: aload_0
    //   12: getfield 59	org/eclipse/ant/internal/launching/AntLaunch:linkDescriptors	Ljava/util/List;
    //   15: invokespecial 63	java/util/ArrayList:<init>	(Ljava/util/Collection;)V
    //   18: aload_1
    //   19: monitorexit
    //   20: areturn
    //   21: aload_1
    //   22: monitorexit
    //   23: athrow
    // Line number table:
    //   Java source line #46	-> byte code offset #0
    //   Java source line #47	-> byte code offset #7
    //   Java source line #46	-> byte code offset #21
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	24	0	this	AntLaunch
    //   5	17	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	20	21	finally
    //   21	23	21	finally
  }
  
  public void clearLinkDescriptors()
  {
    synchronized (linkDescriptors)
    {
      linkDescriptors.clear();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.AntLaunch
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;

public class AntLaunching
  extends Plugin
{
  public static final String PLUGIN_ID = "org.eclipse.ant.launching";
  private static final String EMPTY_STRING = "";
  public static final String SET_INPUTHANDLER = "org.eclipse.ant.uiSET_INPUTHANDLER";
  public static final String ANT_COMMUNICATION_TIMEOUT = "timeout";
  public static final int LEFT_COLUMN_SIZE = 15;
  /**
   * @deprecated
   */
  public static final String ATTR_ANT_CUSTOM_CLASSPATH = "org.eclipse.ui.externaltools.ATTR_ANT_CUSTOM_CLASSPATH";
  /**
   * @deprecated
   */
  public static final String ATTR_ANT_HOME = "org.eclipse.ui.externaltools.ATTR_ANT_HOME";
  public static final int INTERNAL_ERROR = 120;
  private static AntLaunching plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static AntLaunching getDefault()
  {
    return plugin;
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.ant.launching";
  }
  
  public static void log(Throwable t)
  {
    IStatus status = new Status(4, "org.eclipse.ant.launching", 120, "Error logged from Ant UI: ", t);
    log(status);
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(String message, Throwable exception)
  {
    IStatus status = newErrorStatus(message, exception);
    log(status);
  }
  
  public static IStatus newErrorStatus(String message, Throwable exception)
  {
    if (message == null) {
      message = "";
    }
    return new Status(4, "org.eclipse.ant.launching", 0, message, exception);
  }
  
  public static AntLaunching getPlugin()
  {
    return plugin;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.AntLaunching
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;

public class AntLaunchingPreferenceInitializer
  extends AbstractPreferenceInitializer
{
  public void initializeDefaultPreferences()
  {
    IEclipsePreferences node = new DefaultScope()
      .getNode(AntLaunching.getUniqueIdentifier());
    node.put("timeout", 
      "20000");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.AntLaunchingPreferenceInitializer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching;

import com.ibm.icu.text.MessageFormat;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.FileUtils;
import org.eclipse.ant.internal.launching.launchConfigurations.AntHomeClasspathEntry;
import org.eclipse.ant.internal.launching.launchConfigurations.AntProcess;
import org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntRuntimeProcess;
import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry2;
import org.eclipse.jdt.launching.JavaRuntime;

public final class AntLaunchingUtil
{
  public static final String ATTRIBUTE_SEPARATOR = ",";
  public static final char ANT_CLASSPATH_DELIMITER = '*';
  public static final String ANT_HOME_CLASSPATH_PLACEHOLDER = "G";
  public static final String ANT_GLOBAL_USER_CLASSPATH_PLACEHOLDER = "UG";
  
  public static String combineStrings(String[] strings)
  {
    if (strings.length == 0) {
      return null;
    }
    if (strings.length == 1) {
      return strings[0];
    }
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < strings.length - 1; i++)
    {
      buf.append(strings[i]);
      buf.append(",");
    }
    buf.append(strings[(strings.length - 1)]);
    return buf.toString();
  }
  
  public static String[] getTargetNames(ILaunchConfiguration configuration)
    throws CoreException
  {
    String attribute = null;
    if ("org.eclipse.ant.AntBuilderLaunchConfigurationType".equals(configuration.getType().getIdentifier())) {
      attribute = getTargetNamesForAntBuilder(configuration);
    }
    if (attribute == null)
    {
      attribute = configuration.getAttribute(
        "org.eclipse.ui.externaltools.ATTR_ANT_TARGETS", 
        null);
      if (attribute == null) {
        return null;
      }
    }
    return parseRunTargets(attribute);
  }
  
  private static String getTargetNamesForAntBuilder(ILaunchConfiguration configuration)
    throws CoreException
  {
    String buildType = ExternalToolBuilder.getBuildType();
    String targets = null;
    if ("auto".equals(buildType)) {
      targets = configuration.getAttribute(
        "org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS", 
        null);
    } else if ("clean".equals(buildType)) {
      targets = configuration.getAttribute(
        "org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS", 
        null);
    } else if ("full".equals(buildType)) {
      targets = 
        configuration.getAttribute(
        "org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS", 
        null);
    } else if ("incremental".equals(buildType)) {
      targets = configuration.getAttribute(
        "org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS", 
        null);
    }
    return targets;
  }
  
  public static Map getProperties(ILaunchConfiguration configuration)
    throws CoreException
  {
    Map map = configuration.getAttribute(
      "org.eclipse.ui.externaltools.ATTR_ANT_PROPERTIES", 
      null);
    return map;
  }
  
  public static String getAntHome(ILaunchConfiguration configuration)
    throws CoreException
  {
    IRuntimeClasspathEntry[] entries = 
      JavaRuntime.computeUnresolvedRuntimeClasspath(configuration);
    for (int i = 0; i < entries.length; i++)
    {
      IRuntimeClasspathEntry entry = entries[i];
      if (entry.getType() == 5)
      {
        IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
        if (entry2.getTypeId().equals("org.eclipse.ant.ui.classpathentry.antHome")) {
          return ((AntHomeClasspathEntry)entry2).getAntHome();
        }
      }
    }
    return null;
  }
  
  public static String[] getPropertyFiles(ILaunchConfiguration configuration)
    throws CoreException
  {
    String attribute = configuration.getAttribute(
      "org.eclipse.ui.externaltools.ATTR_ANT_PROPERTY_FILES", 
      null);
    if (attribute == null) {
      return null;
    }
    String[] propertyFiles = parseString(attribute, ",");
    for (int i = 0; i < propertyFiles.length; i++)
    {
      String propertyFile = propertyFiles[i];
      propertyFile = expandVariableString(propertyFile, 
        AntCoreModelMessages.AntUtil_6);
      propertyFiles[i] = propertyFile;
    }
    return propertyFiles;
  }
  
  public static URL[] getCustomClasspath(ILaunchConfiguration config)
    throws CoreException
  {
    boolean useDefault = config.getAttribute(
      IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
    if (useDefault) {
      return null;
    }
    IRuntimeClasspathEntry[] unresolved = 
      JavaRuntime.computeUnresolvedRuntimeClasspath(config);
    
    List userEntries = new ArrayList(unresolved.length);
    for (int i = 0; i < unresolved.length; i++)
    {
      IRuntimeClasspathEntry entry = unresolved[i];
      if (entry.getClasspathProperty() == 3) {
        userEntries.add(entry);
      }
    }
    IRuntimeClasspathEntry[] entries = 
      JavaRuntime.resolveRuntimeClasspath(
      (IRuntimeClasspathEntry[])userEntries
      .toArray(new IRuntimeClasspathEntry[userEntries
      .size()]), config);
    URL[] urls = new URL[entries.length];
    for (int i = 0; i < entries.length; i++)
    {
      IRuntimeClasspathEntry entry = entries[i];
      try
      {
        urls[i] = new URL("file:" + entry.getLocation());
      }
      catch (MalformedURLException e)
      {
        throw new CoreException(new Status(4, 
          AntLaunching.getUniqueIdentifier(), 120, 
          AntCoreModelMessages.AntUtil_7, e));
      }
    }
    return urls;
  }
  
  private static String expandVariableString(String variableString, String invalidMessage)
    throws CoreException
  {
    String expandedString = VariablesPlugin.getDefault()
      .getStringVariableManager().performStringSubstitution(
      variableString);
    if ((expandedString == null) || (expandedString.length() == 0))
    {
      String msg = MessageFormat.format(invalidMessage, 
        new String[] { variableString });
      throw new CoreException(new Status(4, 
        "org.eclipse.ant.launching", 0, msg, null));
    }
    return expandedString;
  }
  
  public static String[] parseRunTargets(String extraAttibuteValue)
  {
    return parseString(extraAttibuteValue, ",");
  }
  
  public static String[] parseString(String delimString, String delim)
  {
    if (delimString == null) {
      return new String[0];
    }
    StringTokenizer tokenizer = new StringTokenizer(delimString, delim);
    String[] results = new String[tokenizer.countTokens()];
    for (int i = 0; i < results.length; i++) {
      results[i] = tokenizer.nextToken().trim();
    }
    return results;
  }
  
  public static IFile getFile(String fullPath)
  {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    return root.getFile(new Path(fullPath));
  }
  
  public static IFile getFileForLocation(String path, File buildFileParent)
  {
    if (path == null) {
      return null;
    }
    IPath filePath = new Path(path);
    IFile file = null;
    IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
      .findFilesForLocation(filePath);
    if (files.length > 0) {
      file = files[0];
    }
    if (file == null)
    {
      File relativeFile = null;
      try
      {
        relativeFile = FileUtils.getFileUtils().resolveFile(
          buildFileParent, path);
        filePath = new Path(relativeFile.getAbsolutePath());
        files = ResourcesPlugin.getWorkspace().getRoot()
          .findFilesForLocation(filePath);
        if (files.length > 0) {
          file = files[0];
        } else {
          return null;
        }
      }
      catch (BuildException localBuildException)
      {
        return null;
      }
    }
    if (file.exists()) {
      return file;
    }
    File ioFile = file.getLocation().toFile();
    if (ioFile.exists()) {
      try
      {
        files = 
          ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(
          new Path(ioFile.getCanonicalPath()));
        if (files.length > 0) {
          return files[0];
        }
      }
      catch (IOException localIOException) {}
    }
    return null;
  }
  
  public static void migrateToNewClasspathFormat(ILaunchConfiguration configuration)
    throws CoreException
  {
    String oldClasspath = configuration.getAttribute(
      "org.eclipse.ui.externaltools.ATTR_ANT_CUSTOM_CLASSPATH", 
      null);
    String oldAntHome = configuration.getAttribute(
      "org.eclipse.ui.externaltools.ATTR_ANT_HOME", null);
    String provider = configuration.getAttribute(
      IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, 
      null);
    if ((oldClasspath != null) || (oldAntHome != null) || (provider == null))
    {
      ILaunchConfigurationWorkingCopy workingCopy = null;
      if (configuration.isWorkingCopy()) {
        workingCopy = (ILaunchConfigurationWorkingCopy)configuration;
      } else {
        workingCopy = configuration.getWorkingCopy();
      }
      workingCopy.setAttribute(
        "org.eclipse.ui.externaltools.ATTR_ANT_CUSTOM_CLASSPATH", 
        null);
      workingCopy
        .setAttribute(
        "org.eclipse.ui.externaltools.ATTR_ANT_HOME", 
        null);
      workingCopy.setAttribute(
        IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, 
        "org.eclipse.ant.ui.AntClasspathProvider");
      workingCopy.setAttribute(
        IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, 
        true);
      if (oldAntHome != null)
      {
        IRuntimeClasspathEntry[] entries = 
          JavaRuntime.computeUnresolvedRuntimeClasspath(workingCopy);
        List mementos = new ArrayList(entries.length);
        for (int i = 0; i < entries.length; i++)
        {
          IRuntimeClasspathEntry entry = entries[i];
          if (entry.getType() == 5)
          {
            IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
            if (entry2.getTypeId().equals(
              "org.eclipse.ant.ui.classpathentry.antHome"))
            {
              AntHomeClasspathEntry homeEntry = new AntHomeClasspathEntry(
                oldAntHome);
              mementos.add(homeEntry.getMemento());
              continue;
            }
          }
          mementos.add(entry.getMemento());
        }
        workingCopy.setAttribute(
          IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, 
          false);
        workingCopy.setAttribute(
          IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, 
          mementos);
      }
      workingCopy.doSave();
    }
  }
  
  public static boolean isSeparateJREAntBuild(ILaunchConfiguration configuration)
  {
    boolean separateJRE = true;
    try
    {
      separateJRE = configuration.getAttribute(
        IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, 
        null) != null;
    }
    catch (CoreException e)
    {
      AntLaunching.log(AntCoreModelMessages.AntUtil_2, e);
    }
    return separateJRE;
  }
  
  public static void linkBuildFailedMessage(String message, IProcess process)
  {
    String fileName = null;
    String lineNumber = "";
    int fileStart = 0;
    int index = message.indexOf("xml");
    if (index > 0)
    {
      int numberStart = index + 4;
      int numberEnd = message.indexOf(':', numberStart);
      int fileEnd = index + 3;
      if ((numberStart > 0) && (fileEnd > 0))
      {
        fileName = message.substring(fileStart, fileEnd).trim();
        if (numberEnd > 0) {
          lineNumber = 
            message.substring(numberStart, numberEnd).trim();
        }
      }
    }
    if (fileName != null)
    {
      int num = -1;
      try
      {
        num = Integer.parseInt(lineNumber);
      }
      catch (NumberFormatException localNumberFormatException) {}
      IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
        .findFilesForLocation(new Path(fileName));
      IFile file = null;
      if (files.length > 0) {
        file = files[0];
      }
      if ((file != null) && (file.exists()) && 
        (process != null))
      {
        ILaunch launch = null;
        if ((process instanceof RemoteAntRuntimeProcess)) {
          launch = 
            ((RemoteAntRuntimeProcess)process).getLaunch();
        } else if ((process instanceof AntProcess)) {
          launch = ((AntProcess)process).getLaunch();
        }
        if (launch != null) {
          ((AntLaunch)launch).addLinkDescriptor(message, 
            fileName, num, 0, message.length());
        }
      }
    }
  }
  
  public static boolean isLaunchInBackground(ILaunchConfiguration configuration)
  {
    boolean launchInBackground = true;
    try
    {
      launchInBackground = configuration.getAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", true);
    }
    catch (CoreException ce)
    {
      AntLaunching.log(ce);
    }
    return launchInBackground;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.AntLaunchingUtil
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching;

public abstract interface IAntLaunchingPreferenceConstants
{
  public static final String ANT_COMMUNICATION_TIMEOUT = "timeout";
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.IAntLaunchingPreferenceConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching;

public class LinkDescriptor
{
  String line;
  String fileName;
  int lineNumber;
  int offset;
  int length;
  
  public LinkDescriptor(String line, String fileName, int lineNumber, int offset, int length)
  {
    this.line = line;
    this.fileName = fileName;
    this.lineNumber = lineNumber;
    this.offset = offset;
    this.length = length;
  }
  
  public String getLine()
  {
    return line;
  }
  
  public void setLine(String line)
  {
    this.line = line;
  }
  
  public String getFileName()
  {
    return fileName;
  }
  
  public void setFileName(String fileName)
  {
    this.fileName = fileName;
  }
  
  public int getLineNumber()
  {
    return lineNumber;
  }
  
  public void setLineNumber(int lineNumber)
  {
    this.lineNumber = lineNumber;
  }
  
  public int getOffset()
  {
    return offset;
  }
  
  public void setOffset(int offset)
  {
    this.offset = offset;
  }
  
  public int getLength()
  {
    return length;
  }
  
  public void setLength(int length)
  {
    this.length = length;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.LinkDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

import org.eclipse.osgi.util.NLS;

public class AntDebugMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.ant.internal.launching.debug.AntDebugMessages";
  public static String AntSourceContainer_0;
  
  static
  {
    NLS.initializeMessages("org.eclipse.ant.internal.launching.debug.AntDebugMessages", AntDebugMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.AntDebugMessages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;

public class AntSourceContainer
  extends AbstractSourceContainer
{
  private IWorkspaceRoot fRoot;
  
  public AntSourceContainer()
  {
    fRoot = ResourcesPlugin.getWorkspace().getRoot();
  }
  
  public Object[] findSourceElements(String path)
    throws CoreException
  {
    ArrayList sources = new ArrayList();
    File osFile = new File(path);
    if (osFile.exists()) {
      try
      {
        IPath canonicalPath = new Path(osFile.getCanonicalPath());
        IFile[] files = fRoot.findFilesForLocation(canonicalPath);
        if (files.length > 0) {
          for (int i = 0; i < files.length; i++) {
            sources.add(files[i]);
          }
        } else {
          sources.add(new LocalFileStorage(osFile));
        }
      }
      catch (IOException localIOException) {}
    }
    return sources.toArray();
  }
  
  public String getName()
  {
    return AntDebugMessages.AntSourceContainer_0;
  }
  
  public ISourceContainerType getType()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.AntSourceContainer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;

public class AntSourceLookupDirector
  extends AbstractSourceLookupDirector
{
  public void initializeParticipants()
  {
    addParticipants(new ISourceLookupParticipant[] { new AntSourceLookupParticipant() });
  }
  
  public String getMemento()
    throws CoreException
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.AntSourceLookupDirector
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

import org.eclipse.ant.internal.launching.debug.model.AntStackFrame;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;

public class AntSourceLookupParticipant
  extends AbstractSourceLookupParticipant
{
  public String getSourceName(Object object)
    throws CoreException
  {
    if ((object instanceof AntStackFrame)) {
      return ((AntStackFrame)object).getFilePath();
    }
    if ((object instanceof String)) {
      return (String)object;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.AntSourceLookupParticipant
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;

public class AntSourcePathComputerDelegate
  implements ISourcePathComputerDelegate
{
  public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor)
    throws CoreException
  {
    return new ISourceContainer[] { new AntSourceContainer() };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.AntSourcePathComputerDelegate
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

public abstract interface IAntDebugConstants
{
  public static final String ID_ANT_DEBUG_MODEL = "org.eclipse.ant.ui.debug";
  public static final String ID_ANT_LINE_BREAKPOINT_MARKER = "org.eclipse.ant.ui.antLineBreakpointMarker";
  public static final String ANT_RUN_TO_LINE = "org.eclipse.ant.ui.runToLineBreakpoint";
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.IAntDebugConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug;

import org.eclipse.debug.core.model.IBreakpoint;

public abstract interface IAntDebugController
{
  public abstract void resume();
  
  public abstract void suspend();
  
  public abstract void stepInto();
  
  public abstract void stepOver();
  
  public abstract void terminate();
  
  public abstract void handleBreakpoint(IBreakpoint paramIBreakpoint, boolean paramBoolean);
  
  public abstract void getProperties();
  
  public abstract void getStackFrames();
  
  public abstract StringBuffer unescapeString(StringBuffer paramStringBuffer);
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.IAntDebugController
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug.model;

import org.eclipse.ant.internal.launching.AntLaunching;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.DebugElement;

public abstract class AntDebugElement
  extends DebugElement
{
  public AntDebugElement(AntDebugTarget target)
  {
    super(target);
  }
  
  public String getModelIdentifier()
  {
    return "org.eclipse.ant.ui.debug";
  }
  
  protected void throwDebugException(String message)
    throws DebugException
  {
    throw new DebugException(new Status(4, AntLaunching.getUniqueIdentifier(), 
      5010, message, null));
  }
  
  protected AntDebugTarget getAntDebugTarget()
  {
    return (AntDebugTarget)super.getDebugTarget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.model.AntDebugElement
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.ant.internal.launching.debug.IAntDebugController;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.IBreakpointManagerListener;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IThread;

public class AntDebugTarget
  extends AntDebugElement
  implements IDebugTarget, IDebugEventSetListener, IBreakpointManagerListener
{
  private IProcess fProcess;
  private ILaunch fLaunch;
  private String fName;
  private boolean fSuspended = false;
  private boolean fTerminated = false;
  private AntThread fThread;
  private IThread[] fThreads;
  private IAntDebugController fController;
  private List fRunToLineBreakpoints;
  
  public AntDebugTarget(ILaunch launch, IProcess process, IAntDebugController controller)
  {
    super(null);
    fLaunch = launch;
    fProcess = process;
    
    fController = controller;
    
    fThread = new AntThread(this);
    fThreads = new IThread[] { fThread };
    
    DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this);
    DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
    DebugPlugin.getDefault().addDebugEventListener(this);
  }
  
  public IProcess getProcess()
  {
    return fProcess;
  }
  
  public IThread[] getThreads()
  {
    return fThreads;
  }
  
  public boolean hasThreads()
    throws DebugException
  {
    return (!fTerminated) && (fThreads.length > 0);
  }
  
  public String getName()
    throws DebugException
  {
    if (fName == null) {
      try
      {
        fName = getLaunch().getLaunchConfiguration().getAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", DebugModelMessages.AntDebugTarget_0);
        fName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fName);
      }
      catch (CoreException localCoreException)
      {
        fName = DebugModelMessages.AntDebugTarget_0;
      }
    }
    return fName;
  }
  
  public boolean supportsBreakpoint(IBreakpoint breakpoint)
  {
    if (breakpoint.getModelIdentifier().equals("org.eclipse.ant.ui.debug")) {
      return true;
    }
    return false;
  }
  
  public IDebugTarget getDebugTarget()
  {
    return this;
  }
  
  public ILaunch getLaunch()
  {
    return fLaunch;
  }
  
  public boolean canTerminate()
  {
    return !fTerminated;
  }
  
  public boolean isTerminated()
  {
    return fTerminated;
  }
  
  public void terminate()
    throws DebugException
  {
    terminated();
  }
  
  public boolean canResume()
  {
    return (!fTerminated) && (fSuspended);
  }
  
  public boolean canSuspend()
  {
    return (!fTerminated) && (!fSuspended);
  }
  
  public boolean isSuspended()
  {
    return fSuspended;
  }
  
  public void resume()
    throws DebugException
  {
    fSuspended = false;
    fController.resume();
    if (fThread.isSuspended()) {
      fThread.resumedByTarget();
    }
    fireResumeEvent(32);
  }
  
  public void suspended(int detail)
  {
    fSuspended = true;
    fThread.setStepping(false);
    fThread.fireSuspendEvent(detail);
  }
  
  public void suspend()
    throws DebugException
  {
    fController.suspend();
  }
  
  public void breakpointAdded(IBreakpoint breakpoint)
  {
    if (!fTerminated)
    {
      fController.handleBreakpoint(breakpoint, true);
      if (((breakpoint instanceof AntLineBreakpoint)) && 
        (((AntLineBreakpoint)breakpoint).isRunToLine()))
      {
        if (fRunToLineBreakpoints == null) {
          fRunToLineBreakpoints = new ArrayList();
        }
        fRunToLineBreakpoints.add(breakpoint);
      }
    }
  }
  
  public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta)
  {
    if (!fTerminated)
    {
      fController.handleBreakpoint(breakpoint, false);
      if ((fRunToLineBreakpoints != null) && 
        (fRunToLineBreakpoints.remove(breakpoint)) && (fRunToLineBreakpoints.isEmpty())) {
        fRunToLineBreakpoints = null;
      }
    }
  }
  
  public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta)
  {
    if (supportsBreakpoint(breakpoint)) {
      try
      {
        if ((breakpoint.isEnabled()) && (DebugPlugin.getDefault().getBreakpointManager().isEnabled())) {
          breakpointAdded(breakpoint);
        } else {
          breakpointRemoved(breakpoint, null);
        }
      }
      catch (CoreException localCoreException) {}
    }
  }
  
  public boolean canDisconnect()
  {
    return false;
  }
  
  public void disconnect()
    throws DebugException
  {}
  
  public boolean isDisconnected()
  {
    return false;
  }
  
  public boolean supportsStorageRetrieval()
  {
    return false;
  }
  
  public IMemoryBlock getMemoryBlock(long startAddress, long length)
    throws DebugException
  {
    return null;
  }
  
  public void buildStarted()
  {
    fireCreationEvent();
    installDeferredBreakpoints();
    try
    {
      resume();
    }
    catch (DebugException localDebugException) {}
  }
  
  private void installDeferredBreakpoints()
  {
    IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
    if (!manager.isEnabled()) {
      return;
    }
    IBreakpoint[] breakpoints = manager.getBreakpoints("org.eclipse.ant.ui.debug");
    for (int i = 0; i < breakpoints.length; i++)
    {
      IBreakpoint breakpoint = breakpoints[i];
      try
      {
        if (breakpoint.isEnabled()) {
          breakpointAdded(breakpoints[i]);
        }
      }
      catch (CoreException localCoreException) {}
    }
  }
  
  public void terminated()
  {
    if (!fTerminated)
    {
      fThreads = new IThread[0];
      fTerminated = true;
      fSuspended = false;
      fController.terminate();
      fController = null;
      if (DebugPlugin.getDefault() != null)
      {
        DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
        DebugPlugin.getDefault().removeDebugEventListener(this);
        DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(this);
      }
      if (!getProcess().isTerminated()) {
        try
        {
          fProcess.terminate();
        }
        catch (DebugException localDebugException) {}
      }
      if (DebugPlugin.getDefault() != null) {
        fireTerminateEvent();
      }
    }
  }
  
  public void stepOver()
  {
    fSuspended = false;
    fController.stepOver();
    fireResumeEvent(32);
  }
  
  public void stepInto()
  {
    fSuspended = false;
    fController.stepInto();
    fireResumeEvent(32);
  }
  
  public void breakpointHit(String event)
  {
    String[] datum = event.split(",");
    String fileName = datum[1];
    int lineNumber = Integer.parseInt(datum[2]);
    IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints("org.eclipse.ant.ui.debug");
    boolean found = false;
    for (int i = 0; i < breakpoints.length; i++)
    {
      ILineBreakpoint lineBreakpoint = (ILineBreakpoint)breakpoints[i];
      if (setThreadBreakpoint(lineBreakpoint, lineNumber, fileName))
      {
        found = true;
        break;
      }
    }
    if ((!found) && (fRunToLineBreakpoints != null))
    {
      Iterator iter = fRunToLineBreakpoints.iterator();
      while (iter.hasNext())
      {
        ILineBreakpoint lineBreakpoint = (ILineBreakpoint)iter.next();
        if (setThreadBreakpoint(lineBreakpoint, lineNumber, fileName)) {
          break;
        }
      }
    }
    suspended(16);
  }
  
  private boolean setThreadBreakpoint(ILineBreakpoint lineBreakpoint, int lineNumber, String fileName)
  {
    try
    {
      if ((lineBreakpoint.getLineNumber() == lineNumber) && 
        (fileName.equals(lineBreakpoint.getMarker().getResource().getLocation().toOSString())))
      {
        fThread.setBreakpoints(new IBreakpoint[] { lineBreakpoint });
        return true;
      }
    }
    catch (CoreException localCoreException) {}
    return false;
  }
  
  public void breakpointHit(IBreakpoint breakpoint)
  {
    fThread.setBreakpoints(new IBreakpoint[] { breakpoint });
    suspended(16);
  }
  
  public void getStackFrames()
  {
    if (isSuspended()) {
      fController.getStackFrames();
    }
  }
  
  public void getProperties()
  {
    if (!fTerminated) {
      fController.getProperties();
    }
  }
  
  public void handleDebugEvents(DebugEvent[] events)
  {
    for (int i = 0; i < events.length; i++)
    {
      DebugEvent event = events[i];
      if ((event.getKind() == 8) && (event.getSource().equals(fProcess))) {
        terminated();
      }
    }
  }
  
  public void breakpointManagerEnablementChanged(boolean enabled)
  {
    IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints("org.eclipse.ant.ui.debug");
    for (int i = 0; i < breakpoints.length; i++)
    {
      IBreakpoint breakpoint = breakpoints[i];
      if (enabled) {
        breakpointAdded(breakpoint);
      } else {
        breakpointRemoved(breakpoint, null);
      }
    }
  }
  
  public IAntDebugController getAntDebugController()
  {
    return fController;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ant.internal.launching.debug.model.AntDebugTarget
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ant.internal.launching.debug.model;

import com.ibm.icu.text.MessageFormat;
import java.util.Map;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

class AntLineBreakpoint$1
  implements IWorkspaceRunnable
{
  final AntLineBreakpoint this$0;
  private final IResource val$resource;
  private final Map val$attributes;
  private final int val$lineNumber;
  private final boolean val$register;
  
  AntLineBreakpoint$1(AntLineBreakpoint paramAntLineBreakpoint, IResource paramIResource, Map paramMap, int paramInt, boolean paramBoolean)
  {
    this$0 = paramAntLineBreakpoint;val$resource = paramIResource;val$attributes = paramMap;val$lineNumber = paramInt;val$register = paramBoolean;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    IMarker marker = val$resource.createMarker("org.eclipse.ant.ui.antLineBreakpointMarker");
    this$0.setMarker(marker);
    val$attributes.put("org.eclipse.debug.core.enabled", Boolean.TRUE);
    val$attributes.put("line
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd