org.eclipse.jdt.launching_3.6.1.v20111006_r372

16:45:11.103 INFO  jd.cli.Main - Decompiling org.eclipse.jdt.launching_3.6.1.v20111006_r372.jar
package org.eclipse.jdt.internal.launching;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry2;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public abstract class AbstractRuntimeClasspathEntry
  extends PlatformObject
  implements IRuntimeClasspathEntry2
{
  private IPath sourceAttachmentPath = null;
  private IPath rootSourcePath = null;
  private int classpathProperty = 3;
  private IJavaProject fJavaProject;
  
  public boolean isComposite()
  {
    return false;
  }
  
  public IRuntimeClasspathEntry[] getRuntimeClasspathEntries()
    throws CoreException
  {
    return new IRuntimeClasspathEntry[0];
  }
  
  protected void abort(String message, Throwable exception)
    throws CoreException
  {
    IStatus status = new Status(4, LaunchingPlugin.getUniqueIdentifier(), 150, message, exception);
    throw new CoreException(status);
  }
  
  public String getMemento()
    throws CoreException
  {
    Document doc = DebugPlugin.newDocument();
    Element root = doc.createElement("runtimeClasspathEntry");
    doc.appendChild(root);
    root.setAttribute("id", getTypeId());
    Element memento = doc.createElement("memento");
    root.appendChild(memento);
    buildMemento(doc, memento);
    return DebugPlugin.serializeDocument(doc);
  }
  
  protected abstract void buildMemento(Document paramDocument, Element paramElement)
    throws CoreException;
  
  public IPath getPath()
  {
    return null;
  }
  
  public IResource getResource()
  {
    return null;
  }
  
  public IPath getSourceAttachmentPath()
  {
    return sourceAttachmentPath;
  }
  
  public void setSourceAttachmentPath(IPath path)
  {
    sourceAttachmentPath = path;
  }
  
  public IPath getSourceAttachmentRootPath()
  {
    return rootSourcePath;
  }
  
  public void setSourceAttachmentRootPath(IPath path)
  {
    rootSourcePath = path;
  }
  
  public int getClasspathProperty()
  {
    return classpathProperty;
  }
  
  public void setClasspathProperty(int property)
  {
    classpathProperty = property;
  }
  
  public String getLocation()
  {
    return null;
  }
  
  public String getSourceAttachmentLocation()
  {
    return null;
  }
  
  public String getSourceAttachmentRootLocation()
  {
    return null;
  }
  
  public String getVariableName()
  {
    return null;
  }
  
  public IClasspathEntry getClasspathEntry()
  {
    return null;
  }
  
  public IJavaProject getJavaProject()
  {
    return fJavaProject;
  }
  
  protected void setJavaProject(IJavaProject javaProject)
  {
    fJavaProject = javaProject;
  }
}

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

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
import org.eclipse.jdt.launching.sourcelookup.containers.ClasspathContainerSourceContainer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class ClasspathContainerSourceContainerTypeDelegate
  extends AbstractSourceContainerTypeDelegate
{
  public ISourceContainer createSourceContainer(String memento)
    throws CoreException
  {
    Node node = parseDocument(memento);
    if (node.getNodeType() == 1)
    {
      Element element = (Element)node;
      if ("classpathContainer".equals(element.getNodeName()))
      {
        String string = element.getAttribute("path");
        if ((string == null) || (string.length() == 0)) {
          abort(LaunchingMessages.ClasspathContainerSourceContainerTypeDelegate_5, null);
        }
        return new ClasspathContainerSourceContainer(new Path(string));
      }
      abort(LaunchingMessages.ClasspathContainerSourceContainerTypeDelegate_6, null);
    }
    abort(LaunchingMessages.ClasspathContainerSourceContainerTypeDelegate_7, null);
    return null;
  }
  
  public String getMemento(ISourceContainer container)
    throws CoreException
  {
    ClasspathContainerSourceContainer var = (ClasspathContainerSourceContainer)container;
    Document document = newDocument();
    Element element = document.createElement("classpathContainer");
    element.setAttribute("path", var.getPath().toString());
    document.appendChild(element);
    return serializeDocument(document);
  }
}

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

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate;
import org.eclipse.jdt.launching.sourcelookup.containers.ClasspathVariableSourceContainer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class ClasspathVariableSourceContainerTypeDelegate
  extends AbstractSourceContainerTypeDelegate
{
  public ISourceContainer createSourceContainer(String memento)
    throws CoreException
  {
    Node node = parseDocument(memento);
    if (node.getNodeType() == 1)
    {
      Element element = (Element)node;
      if ("classpathVariable".equals(element.getNodeName()))
      {
        String string = element.getAttribute("path");
        if ((string == null) || (string.length() == 0)) {
          abort(LaunchingMessages.ClasspathVariableSourceContainerTypeDelegate_5, null);
        }
        return new ClasspathVariableSourceContainer(new Path(string));
      }
      abort(LaunchingMessages.ClasspathVariableSourceContainerTypeDelegate_6, null);
    }
    abort(LaunchingMessages.ClasspathVariableSourceContainerTypeDelegate_7, null);
    return null;
  }
  
  public String getMemento(ISourceContainer container)
    throws CoreException
  {
    ClasspathVariableSourceContainer var = (ClasspathVariableSourceContainer)container;
    Document document = newDocument();
    Element element = document.createElement("classpathVariable");
    element.setAttribute("path", var.getPath().toString());
    document.appendChild(element);
    return serializeDocument(document);
  }
}

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

import java.util.ArrayList;

public class CompositeId
{
  private String[] fParts;
  
  public CompositeId(String[] parts)
  {
    fParts = parts;
  }
  
  public static CompositeId fromString(String idString)
  {
    ArrayList parts = new ArrayList();
    int commaIndex = idString.indexOf(',');
    while (commaIndex > 0)
    {
      int length = Integer.valueOf(idString.substring(0, commaIndex)).intValue();
      String part = idString.substring(commaIndex + 1, commaIndex + 1 + length);
      parts.add(part);
      idString = idString.substring(commaIndex + 1 + length);
      commaIndex = idString.indexOf(',');
    }
    String[] result = (String[])parts.toArray(new String[parts.size()]);
    return new CompositeId(result);
  }
  
  public String toString()
  {
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < fParts.length; i++)
    {
      buf.append(fParts[i].length());
      buf.append(',');
      buf.append(fParts[i]);
    }
    return buf.toString();
  }
  
  public String get(int index)
  {
    return fParts[index];
  }
  
  public int getPartCount()
  {
    return fParts.length;
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry2;
import org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;

public class DefaultEntryResolver
  implements IRuntimeClasspathEntryResolver
{
  public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration)
    throws CoreException
  {
    IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
    IRuntimeClasspathEntry[] entries = entry2.getRuntimeClasspathEntries(configuration);
    List resolved = new ArrayList();
    for (int i = 0; i < entries.length; i++)
    {
      IRuntimeClasspathEntry[] temp = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration);
      for (int j = 0; j < temp.length; j++) {
        resolved.add(temp[j]);
      }
    }
    return (IRuntimeClasspathEntry[])resolved.toArray(new IRuntimeClasspathEntry[resolved.size()]);
  }
  
  public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project)
    throws CoreException
  {
    IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
    IRuntimeClasspathEntry[] entries = entry2.getRuntimeClasspathEntries(null);
    List resolved = new ArrayList();
    for (int i = 0; i < entries.length; i++)
    {
      IRuntimeClasspathEntry[] temp = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], project);
      for (int j = 0; j < temp.length; j++) {
        resolved.add(temp[j]);
      }
    }
    return (IRuntimeClasspathEntry[])resolved.toArray(new IRuntimeClasspathEntry[resolved.size()]);
  }
  
  public IVMInstall resolveVMInstall(IClasspathEntry entry)
    throws CoreException
  {
    return null;
  }
}

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

import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
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.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.core.ClasspathContainerInitializer;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeContainerComparator;
import org.eclipse.jdt.launching.JavaRuntime;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class DefaultProjectClasspathEntry
  extends AbstractRuntimeClasspathEntry
{
  public static final String TYPE_ID = "org.eclipse.jdt.launching.classpathentry.defaultClasspath";
  private boolean fExportedEntriesOnly = false;
  
  public DefaultProjectClasspathEntry() {}
  
  public DefaultProjectClasspathEntry(IJavaProject project)
  {
    setJavaProject(project);
  }
  
  protected void buildMemento(Document document, Element memento)
    throws CoreException
  {
    memento.setAttribute("project", getJavaProject().getElementName());
    memento.setAttribute("exportedEntriesOnly", Boolean.toString(fExportedEntriesOnly));
  }
  
  public void initializeFrom(Element memento)
    throws CoreException
  {
    String name = memento.getAttribute("project");
    if (name == null) {
      abort(LaunchingMessages.DefaultProjectClasspathEntry_3, null);
    }
    IJavaProject project = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(name));
    setJavaProject(project);
    name = memento.getAttribute("exportedEntriesOnly");
    if (name == null) {
      fExportedEntriesOnly = false;
    } else {
      fExportedEntriesOnly = Boolean.valueOf(name).booleanValue();
    }
  }
  
  public String getTypeId()
  {
    return "org.eclipse.jdt.launching.classpathentry.defaultClasspath";
  }
  
  public int getType()
  {
    return 5;
  }
  
  protected IProject getProject()
  {
    return getJavaProject().getProject();
  }
  
  public String getLocation()
  {
    return getProject().getLocation().toOSString();
  }
  
  public IPath getPath()
  {
    return getProject().getFullPath();
  }
  
  public IResource getResource()
  {
    return getProject();
  }
  
  public IRuntimeClasspathEntry[] getRuntimeClasspathEntries(ILaunchConfiguration configuration)
    throws CoreException
  {
    IClasspathEntry entry = JavaCore.newProjectEntry(getJavaProject().getProject().getFullPath());
    List classpathEntries = new ArrayList(5);
    List expanding = new ArrayList(5);
    expandProject(entry, classpathEntries, expanding);
    IRuntimeClasspathEntry[] runtimeEntries = new IRuntimeClasspathEntry[classpathEntries.size()];
    for (int i = 0; i < runtimeEntries.length; i++)
    {
      Object e = classpathEntries.get(i);
      if ((e instanceof IClasspathEntry))
      {
        IClasspathEntry cpe = (IClasspathEntry)e;
        runtimeEntries[i] = new RuntimeClasspathEntry(cpe);
      }
      else
      {
        runtimeEntries[i] = ((IRuntimeClasspathEntry)e);
      }
    }
    List ordered = new ArrayList(runtimeEntries.length);
    for (int i = 0; i < runtimeEntries.length; i++) {
      if (runtimeEntries[i].getClasspathProperty() == 3) {
        ordered.add(runtimeEntries[i]);
      }
    }
    return (IRuntimeClasspathEntry[])ordered.toArray(new IRuntimeClasspathEntry[ordered.size()]);
  }
  
  private void expandProject(IClasspathEntry projectEntry, List expandedPath, List expanding)
    throws CoreException
  {
    expanding.add(projectEntry);
    
    IPath projectPath = projectEntry.getPath();
    IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(projectPath.lastSegment());
    if (res == null)
    {
      expandedPath.add(projectEntry);
      return;
    }
    IJavaProject project = (IJavaProject)JavaCore.create(res);
    if ((project == null) || (!project.getProject().isOpen()) || (!project.exists()))
    {
      expandedPath.add(projectEntry);
      return;
    }
    IClasspathEntry[] buildPath = project.getRawClasspath();
    List unexpandedPath = new ArrayList(buildPath.length);
    boolean projectAdded = false;
    for (int i = 0; i < buildPath.length; i++)
    {
      IClasspathEntry classpathEntry = buildPath[i];
      if (classpathEntry.getEntryKind() == 3)
      {
        if (!projectAdded)
        {
          projectAdded = true;
          unexpandedPath.add(projectEntry);
        }
      }
      else if (classpathEntry.isExported()) {
        unexpandedPath.add(classpathEntry);
      } else if ((!isExportedEntriesOnly()) || (project.equals(getJavaProject()))) {
        unexpandedPath.add(classpathEntry);
      }
    }
    Iterator iter = unexpandedPath.iterator();
    while (iter.hasNext())
    {
      IClasspathEntry entry = (IClasspathEntry)iter.next();
      if (entry == projectEntry) {
        expandedPath.add(entry);
      } else {
        switch (entry.getEntryKind())
        {
        case 2: 
          if (!expanding.contains(entry)) {
            expandProject(entry, expandedPath, expanding);
          }
          break;
        case 5: 
          IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
          int property = -1;
          if (container != null)
          {
            switch (container.getKind())
            {
            case 1: 
              property = 3;
              break;
            case 3: 
              property = 1;
              break;
            case 2: 
              property = 2;
            }
            IRuntimeClasspathEntry r = JavaRuntime.newRuntimeContainerClasspathEntry(entry.getPath(), property, project);
            
            boolean duplicate = false;
            ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(r.getPath().segment(0));
            for (int i = 0; i < expandedPath.size(); i++)
            {
              Object o = expandedPath.get(i);
              if ((o instanceof IRuntimeClasspathEntry))
              {
                IRuntimeClasspathEntry re = (IRuntimeClasspathEntry)o;
                if (re.getType() == 4)
                {
                  if ((container instanceof IRuntimeContainerComparator))
                  {
                    duplicate = ((IRuntimeContainerComparator)container).isDuplicate(re.getPath());
                  }
                  else
                  {
                    ClasspathContainerInitializer initializer2 = JavaCore.getClasspathContainerInitializer(re.getPath().segment(0));
                    Object id1 = null;
                    Object id2 = null;
                    if (initializer == null) {
                      id1 = r.getPath().segment(0);
                    } else {
                      id1 = initializer.getComparisonID(r.getPath(), project);
                    }
                    if (initializer2 == null)
                    {
                      id2 = re.getPath().segment(0);
                    }
                    else
                    {
                      IJavaProject context = re.getJavaProject();
                      if (context == null) {
                        context = project;
                      }
                      id2 = initializer2.getComparisonID(re.getPath(), context);
                    }
                    if (id1 == null) {
                      duplicate = id2 == null;
                    } else {
                      duplicate = id1.equals(id2);
                    }
                  }
                  if (duplicate) {
                    break;
                  }
                }
              }
            }
            if (!duplicate) {
              expandedPath.add(r);
            }
          }
          break;
        case 4: 
          IRuntimeClasspathEntry r = JavaRuntime.newVariableRuntimeClasspathEntry(entry.getPath());
          r.setSourceAttachmentPath(entry.getSourceAttachmentPath());
          r.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath());
          if (!expandedPath.contains(r)) {
            expandedPath.add(r);
          }
          break;
        case 3: 
        default: 
          if (!expandedPath.contains(entry)) {
            if (entry.getEntryKind() != 3)
            {
              IPackageFragmentRoot[] roots = project.findPackageFragmentRoots(entry);
              for (int i = 0; i < roots.length; i++)
              {
                IPackageFragmentRoot root = roots[i];
                IRuntimeClasspathEntry r = JavaRuntime.newArchiveRuntimeClasspathEntry(root.getPath());
                r.setSourceAttachmentPath(entry.getSourceAttachmentPath());
                r.setSourceAttachmentRootPath(entry.getSourceAttachmentRootPath());
                if (!expandedPath.contains(r)) {
                  expandedPath.add(r);
                }
              }
            }
            else
            {
              expandedPath.add(entry);
            }
          }
          break;
        }
      }
    }
  }
  
  public boolean isComposite()
  {
    return true;
  }
  
  public String getName()
  {
    if (isExportedEntriesOnly()) {
      return MessageFormat.format(LaunchingMessages.DefaultProjectClasspathEntry_2, new String[] { getJavaProject().getElementName() });
    }
    return MessageFormat.format(LaunchingMessages.DefaultProjectClasspathEntry_4, new String[] { getJavaProject().getElementName() });
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof DefaultProjectClasspathEntry))
    {
      DefaultProjectClasspathEntry entry = (DefaultProjectClasspathEntry)obj;
      
      return (entry.getJavaProject().equals(getJavaProject())) && (entry.isExportedEntriesOnly() == isExportedEntriesOnly());
    }
    return false;
  }
  
  public int hashCode()
  {
    return getJavaProject().hashCode();
  }
  
  public void setExportedEntriesOnly(boolean exportedOnly)
  {
    fExportedEntriesOnly = exportedOnly;
  }
  
  public boolean isExportedEntriesOnly()
  {
    return fExportedEntriesOnly;
  }
}

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

import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.compiler.CompilationParticipant;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;

public class EECompilationParticipant
  extends CompilationParticipant
{
  private Set fCleaned = new HashSet();
  
  public boolean isActive(IJavaProject project)
  {
    return true;
  }
  
  public void cleanStarting(IJavaProject project)
  {
    super.cleanStarting(project);
    fCleaned.add(project);
  }
  
  public void buildFinished(IJavaProject project)
  {
    super.buildFinished(project);
    if (fCleaned.remove(project))
    {
      String eeId = null;
      IPath container = null;
      try
      {
        IClasspathEntry[] rawClasspath = project.getRawClasspath();
        for (int j = 0; j < rawClasspath.length; j++)
        {
          IClasspathEntry entry = rawClasspath[j];
          if (entry.getEntryKind() == 5)
          {
            IPath path = entry.getPath();
            if (JavaRuntime.JRE_CONTAINER.equals(path.segment(0)))
            {
              container = path;
              eeId = JREContainerInitializer.getExecutionEnvironmentId(path);
            }
          }
        }
      }
      catch (CoreException e)
      {
        LaunchingPlugin.log(e);
      }
      if ((container != null) && (eeId != null))
      {
        IVMInstall vm = JREContainerInitializer.resolveVM(container);
        validateEnvironment(eeId, project, vm);
      }
    }
  }
  
  private void validateEnvironment(String id, IJavaProject project, IVMInstall vm)
  {
    IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
    IExecutionEnvironment environment = manager.getEnvironment(id);
    if (environment != null) {
      if (vm == null)
      {
        String message = MessageFormat.format(
          LaunchingMessages.LaunchingPlugin_38, 
          new String[] { environment.getId() });
        createJREContainerProblem(project, message, 2);
      }
      else if (!environment.isStrictlyCompatible(vm))
      {
        IVMInstall[] compatibleVMs = environment.getCompatibleVMs();
        int exact = 0;
        for (int i = 0; i < compatibleVMs.length; i++) {
          if (environment.isStrictlyCompatible(compatibleVMs[i])) {
            exact++;
          }
        }
        String message = null;
        if (exact == 0) {
          message = MessageFormat.format(
            LaunchingMessages.LaunchingPlugin_35, 
            new String[] { environment.getId() });
        } else {
          message = MessageFormat.format(
            LaunchingMessages.LaunchingPlugin_36, 
            new String[] { environment.getId() });
        }
        int sev = getSeverityLevel(JavaRuntime.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE, project.getProject());
        if (sev != -1) {
          createJREContainerProblem(project, message, sev);
        }
      }
    }
  }
  
  private int getSeverityLevel(String prefkey, IProject project)
  {
    IPreferencesService service = Platform.getPreferencesService();
    List scopes = new ArrayList();
    scopes.add(InstanceScope.INSTANCE);
    if (project != null) {
      scopes.add(new ProjectScope(project));
    }
    String value = service.getString("org.eclipse.jdt.launching", prefkey, null, (IScopeContext[])scopes.toArray(new IScopeContext[scopes.size()]));
    if (value == null) {
      value = InstanceScope.INSTANCE.getNode("org.eclipse.jdt.launching").get(prefkey, null);
    }
    if ("error".equals(value)) {
      return 2;
    }
    if ("warning".equals(value)) {
      return 1;
    }
    return -1;
  }
  
  private void createJREContainerProblem(IJavaProject javaProject, String message, int severity)
  {
    try
    {
      IMarker marker = javaProject.getProject().createMarker(JavaRuntime.JRE_CONTAINER_MARKER);
      marker.setAttributes(
        new String[] {
        "message", 
        "severity", 
        "location" }, 
        new Object[] {
        message, 
        new Integer(severity), 
        LaunchingMessages.LaunchingPlugin_37 });
    }
    catch (CoreException localCoreException) {}
  }
}

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

import java.io.File;
import org.eclipse.jdt.launching.IVMInstallType;

public class EEVMInstall
  extends StandardVM
{
  public static final String ATTR_JAVA_VERSION = "ATTR_JAVA_VERSION";
  public static final String ATTR_EXECUTION_ENVIRONMENT_ID = "ATTR_EXECUTION_ENVIRONMENT_ID";
  public static final String ATTR_JAVA_EXE = "ATTR_JAVA_EXE";
  public static final String ATTR_DEBUG_ARGS = "ATTR_DEBUG_ARGS";
  public static final String ATTR_DEFINITION_FILE = "ATTR_DEFINITION_FILE";
  
  EEVMInstall(IVMInstallType type, String id)
  {
    super(type, id);
  }
  
  public String getJavaVersion()
  {
    return getAttribute("ATTR_JAVA_VERSION");
  }
  
  File getJavaExecutable()
  {
    String exe = getAttribute("ATTR_JAVA_EXE");
    if (exe != null) {
      return new File(exe);
    }
    return null;
  }
  
  public String getDebugArgs()
  {
    return getAttribute("ATTR_DEBUG_ARGS");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.launching.EEVMInstall
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.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.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.launching.AbstractVMInstallType;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.LibraryLocation;
import org.eclipse.jdt.launching.environments.ExecutionEnvironmentDescription;

public class EEVMType
  extends AbstractVMInstallType
{
  public static final String ID_EE_VM_TYPE = "org.eclipse.jdt.launching.EEVMType";
  public static final String VAR_EE_HOME = "${ee.home}";
  private static final String[] REQUIRED_PROPERTIES = {
    "-Dee.executable", 
    "-Dee.bootclasspath", 
    "-Dee.language.level", 
    "-Djava.home" };
  
  public static URL getJavadocLocation(Map properties)
  {
    String javadoc = getProperty("-Dee.javadoc", properties);
    if ((javadoc != null) && (javadoc.length() > 0)) {
      try
      {
        URL url = new URL(javadoc);
        File file;
        if ("file".equalsIgnoreCase(url.getProtocol())) {
          file = new File(url.getFile());
        }
        return file.getCanonicalFile().toURL();
      }
      catch (MalformedURLException e)
      {
        LaunchingPlugin.log(e);
        return null;
      }
      catch (IOException e)
      {
        LaunchingPlugin.log(e);
        return null;
      }
    }
    String version = getProperty("-Dee.language.level", properties);
    if (version != null) {
      return StandardVMType.getDefaultJavadocLocation(version);
    }
    return null;
  }
  
  public static IStatus validateDefinitionFile(ExecutionEnvironmentDescription description)
  {
    for (int i = 0; i < REQUIRED_PROPERTIES.length; i++)
    {
      String key = REQUIRED_PROPERTIES[i];
      String property = description.getProperty(key);
      if (property == null) {
        return new Status(4, LaunchingPlugin.getUniqueIdentifier(), MessageFormat.format(LaunchingMessages.EEVMType_1, new String[] { key }));
      }
    }
    return Status.OK_STATUS;
  }
  
  private static String getProperty(String property, Map properties)
  {
    return (String)properties.get(property);
  }
  
  protected IVMInstall doCreateVMInstall(String id)
  {
    return new EEVMInstall(this, id);
  }
  
  public File detectInstallLocation()
  {
    return null;
  }
  
  public LibraryLocation[] getDefaultLibraryLocations(File installLocationOrDefinitionFile)
  {
    return new LibraryLocation[0];
  }
  
  public String getName()
  {
    return LaunchingMessages.EEVMType_2;
  }
  
  public IStatus validateInstallLocation(File installLocation)
  {
    if (installLocation.exists()) {
      return new Status(1, "org.eclipse.jdt.launching", LaunchingMessages.EEVMType_4);
    }
    return new Status(4, "org.eclipse.jdt.launching", MessageFormat.format(LaunchingMessages.EEVMType_3, new String[] { installLocation.getPath() }));
  }
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallChangedListener;
import org.eclipse.jdt.launching.PropertyChangeEvent;

class JREContainer$1
  implements IVMInstallChangedListener
{
  public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current) {}
  
  public void vmAdded(IVMInstall newVm) {}
  
  public void vmChanged(PropertyChangeEvent event)
  {
    if (event.getSource() != null)
    {
      JREContainer.access$0().remove(event.getSource());
      removeRuleEntry(event.getSource());
    }
  }
  
  public void vmRemoved(IVMInstall removedVm)
  {
    JREContainer.access$0().remove(removedVm);
    removeRuleEntry(removedVm);
  }
  
  private void removeRuleEntry(Object obj)
  {
    if ((obj instanceof IVMInstall))
    {
      IVMInstall install = (IVMInstall)obj;
      JREContainer.RuleKey key = null;
      ArrayList list = new ArrayList();
      for (Iterator iter = JREContainer.access$1().keySet().iterator(); iter.hasNext();)
      {
        key = (JREContainer.RuleKey)iter.next();
        if (JREContainer.RuleKey.access$0(key).equals(install)) {
          list.add(key);
        }
      }
      for (int i = 0; i < list.size(); i++) {
        JREContainer.access$1().remove(list.get(i));
      }
    }
  }
}

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

import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathEntry;

class JREContainer$RuleEntry
{
  private IAccessRule[][] fRules = null;
  private IClasspathEntry[] fEntries = null;
  
  public JREContainer$RuleEntry(IAccessRule[][] rules, IClasspathEntry[] entries)
  {
    fRules = rules;
    fEntries = entries;
  }
  
  public IClasspathEntry[] getClasspathEntries()
  {
    return fEntries;
  }
  
  public boolean equals(Object obj)
  {
    IAccessRule[][] rules = (IAccessRule[][])null;
    if ((obj instanceof RuleEntry)) {
      rules = fRules;
    }
    if ((obj instanceof IAccessRule[][])) {
      rules = (IAccessRule[][])obj;
    }
    if (rules != null)
    {
      if (fRules == rules) {
        return true;
      }
      if (fRules.length == rules.length)
      {
        boolean equal = true;
        IAccessRule[] comparerule = (IAccessRule[])null;
        for (int i = 0; i < fRules.length; i++)
        {
          IAccessRule[] originalrule = fRules[i];
          comparerule = rules[i];
          equal &= originalrule == comparerule;
          if (!equal)
          {
            if (originalrule.length == comparerule.length)
            {
              for (int j = 0; j < originalrule.length; j++) {
                if (!originalrule[j].equals(comparerule[j])) {
                  return false;
                }
              }
              return true;
            }
            return false;
          }
        }
        return equal;
      }
    }
    return false;
  }
}

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

import org.eclipse.jdt.launching.IVMInstall;

class JREContainer$RuleKey
{
  private String fEnvironmentId = null;
  private IVMInstall fInstall = null;
  
  public JREContainer$RuleKey(IVMInstall install, String environmentId)
  {
    fInstall = install;
    fEnvironmentId = environmentId;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof RuleKey))
    {
      RuleKey key = (RuleKey)obj;
      return (fEnvironmentId.equals(fEnvironmentId)) && (fInstall.equals(fInstall));
    }
    return false;
  }
  
  public int hashCode()
  {
    return fEnvironmentId.hashCode() + fInstall.hashCode();
  }
}

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

import com.ibm.icu.text.MessageFormat;
import java.io.PrintStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallChangedListener;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.LibraryLocation;
import org.eclipse.jdt.launching.PropertyChangeEvent;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;

public class JREContainer
  implements IClasspathContainer
{
  private IVMInstall fVMInstall = null;
  private IPath fPath = null;
  private IJavaProject fProject = null;
  private static Map fgClasspathEntries = new HashMap(10);
  private static IAccessRule[] EMPTY_RULES = new IAccessRule[0];
  private static Map fgClasspathEntriesWithRules = new HashMap(10);
  
  static class RuleKey
  {
    private String fEnvironmentId = null;
    private IVMInstall fInstall = null;
    
    public RuleKey(IVMInstall install, String environmentId)
    {
      fInstall = install;
      fEnvironmentId = environmentId;
    }
    
    public boolean equals(Object obj)
    {
      if ((obj instanceof RuleKey))
      {
        RuleKey key = (RuleKey)obj;
        return (fEnvironmentId.equals(fEnvironmentId)) && (fInstall.equals(fInstall));
      }
      return false;
    }
    
    public int hashCode()
    {
      return fEnvironmentId.hashCode() + fInstall.hashCode();
    }
  }
  
  static class RuleEntry
  {
    private IAccessRule[][] fRules = null;
    private IClasspathEntry[] fEntries = null;
    
    public RuleEntry(IAccessRule[][] rules, IClasspathEntry[] entries)
    {
      fRules = rules;
      fEntries = entries;
    }
    
    public IClasspathEntry[] getClasspathEntries()
    {
      return fEntries;
    }
    
    public boolean equals(Object obj)
    {
      IAccessRule[][] rules = (IAccessRule[][])null;
      if ((obj instanceof RuleEntry)) {
        rules = fRules;
      }
      if ((obj instanceof IAccessRule[][])) {
        rules = (IAccessRule[][])obj;
      }
      if (rules != null)
      {
        if (fRules == rules) {
          return true;
        }
        if (fRules.length == rules.length)
        {
          boolean equal = true;
          IAccessRule[] comparerule = (IAccessRule[])null;
          for (int i = 0; i < fRules.length; i++)
          {
            IAccessRule[] originalrule = fRules[i];
            comparerule = rules[i];
            equal &= originalrule == comparerule;
            if (!equal)
            {
              if (originalrule.length == comparerule.length)
              {
                for (int j = 0; j < originalrule.length; j++) {
                  if (!originalrule[j].equals(comparerule[j])) {
                    return false;
                  }
                }
                return true;
              }
              return false;
            }
          }
          return equal;
        }
      }
      return false;
    }
  }
  
  static
  {
    IVMInstallChangedListener listener = new IVMInstallChangedListener()
    {
      public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current) {}
      
      public void vmAdded(IVMInstall newVm) {}
      
      public void vmChanged(PropertyChangeEvent event)
      {
        if (event.getSource() != null)
        {
          JREContainer.fgClasspathEntries.remove(event.getSource());
          removeRuleEntry(event.getSource());
        }
      }
      
      public void vmRemoved(IVMInstall removedVm)
      {
        JREContainer.fgClasspathEntries.remove(removedVm);
        removeRuleEntry(removedVm);
      }
      
      private void removeRuleEntry(Object obj)
      {
        if ((obj instanceof IVMInstall))
        {
          IVMInstall install = (IVMInstall)obj;
          JREContainer.RuleKey key = null;
          ArrayList list = new ArrayList();
          for (Iterator iter = JREContainer.fgClasspathEntriesWithRules.keySet().iterator(); iter.hasNext();)
          {
            key = (JREContainer.RuleKey)iter.next();
            if (JREContainer.RuleKey.access$0(key).equals(install)) {
              list.add(key);
            }
          }
          for 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

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