org.eclipse.pde.core_3.7.1.v20120103_r372

ring key)
  {
    validateDirectiveValue(header, element, key, BOOLEAN_VALUES);
  }
  
  protected void validateBooleanValue(IHeader header)
  {
    validateHeaderValue(header, BOOLEAN_VALUES);
  }
  
  protected void validate(IProgressMonitor monitor)
  {
    if (fTextDocument != null) {
      parseManifest(fTextDocument, monitor);
    }
  }
  
  protected void validateDirectiveValue(IHeader header, ManifestElement element, String key, String[] allowedValues)
  {
    String value = element.getDirective(key);
    if (value == null) {
      return;
    }
    for (int i = 0; i < allowedValues.length; i++) {
      if (allowedValues[i].equals(value)) {
        return;
      }
    }
    reportIllegalDirectiveValue(header, key, value);
  }
  
  protected void validateHeaderValue(IHeader header, String[] allowedValues)
  {
    ManifestElement[] elements = header.getElements();
    if (elements.length > 0)
    {
      for (int i = 0; i < allowedValues.length; i++) {
        if (allowedValues[i].equals(elements[0].getValue())) {
          return;
        }
      }
      reportIllegalValue(header, elements[0].getValue());
    }
  }
  
  protected IHeader validateRequiredHeader(String name)
  {
    IHeader header = (IHeader)fHeaders.get(name.toLowerCase());
    if (header == null) {
      report(NLS.bind(PDECoreMessages.BundleErrorReporter_headerMissing, name), 1, 0, "fatal");
    }
    return header;
  }
  
  protected IHeader getHeader(String key)
  {
    return (IHeader)fHeaders.get(key.toLowerCase());
  }
  
  protected void checkCanceled(IProgressMonitor monitor)
    throws OperationCanceledException
  {
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.JarManifestErrorReporter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.internal.core.PDECoreMessages;
import org.osgi.framework.BundleException;

public class JarManifestHeader
  implements IHeader
{
  private JarManifestErrorReporter fErrorReporter;
  private int fLineNumber;
  private int fLines;
  private ManifestElement[] fManifestElements;
  private String fName;
  private String fValue;
  
  public JarManifestHeader(String name, String value, int lineNumber, JarManifestErrorReporter errorReporter)
  {
    fName = name;
    fValue = value;
    fLineNumber = lineNumber;
    fErrorReporter = errorReporter;
    fLines = 1;
  }
  
  public void append(String value)
  {
    fValue += value;
    fLines += 1;
  }
  
  public ManifestElement[] getElements()
  {
    if (fManifestElements == null) {
      if (getValue().trim().length() > 0)
      {
        try
        {
          fManifestElements = ManifestElement.parseHeader(getName(), getValue());
        }
        catch (BundleException localBundleException)
        {
          fManifestElements = new ManifestElement[0];
          if (fErrorReporter == null) {
            break label94;
          }
        }
        String message = NLS.bind(PDECoreMessages.BundleErrorReporter_parseHeader, getName());
        fErrorReporter.report(message, getLineNumber() + 1, 0, "fatal");
      }
      else
      {
        fManifestElements = new ManifestElement[0];
      }
    }
    label94:
    return fManifestElements;
  }
  
  public int getLineNumber()
  {
    return fLineNumber;
  }
  
  public int getLinesSpan()
  {
    return fLines;
  }
  
  public String getName()
  {
    return fName;
  }
  
  public String getValue()
  {
    return fValue;
  }
  
  public String toString()
  {
    return fName + "=" + fValue;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.JarManifestHeader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.runtime.CoreException;

class ManifestConsistencyChecker$ClassChangeVisitor
  implements IResourceDeltaVisitor
{
  boolean hasChanged;
  boolean veto;
  final ManifestConsistencyChecker this$0;
  
  ManifestConsistencyChecker$ClassChangeVisitor(ManifestConsistencyChecker paramManifestConsistencyChecker)
  {
    this$0 = paramManifestConsistencyChecker;
    hasChanged = false;
    veto = false;
  }
  
  public boolean visit(IResourceDelta delta)
    throws CoreException
  {
    if ((delta != null) && (!veto))
    {
      int kind = delta.getKind();
      if (kind == 4)
      {
        IResource resource = delta.getResource();
        if ((resource instanceof IFile))
        {
          String extension = resource.getFileExtension();
          if ("java".equals(extension)) {
            veto = true;
          } else if (("class".equals(extension)) && (!hasChanged)) {
            hasChanged = true;
          }
        }
        return !veto;
      }
    }
    return false;
  }
  
  public void reset()
  {
    veto = false;
    hasChanged = false;
  }
  
  public boolean hasChanged()
  {
    return (hasChanged) && (!veto);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.ClassChangeVisitor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import java.io.File;
import java.io.FilenameFilter;

class ManifestConsistencyChecker$ManifestFilter
  implements FilenameFilter
{
  final ManifestConsistencyChecker this$0;
  
  ManifestConsistencyChecker$ManifestFilter(ManifestConsistencyChecker paramManifestConsistencyChecker)
  {
    this$0 = paramManifestConsistencyChecker;
  }
  
  public boolean accept(File dir, String name)
  {
    return name.equalsIgnoreCase("MANIFEST.MF");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.ManifestFilter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import java.io.PrintStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.pde.internal.core.project.PDEProject;

class ManifestConsistencyChecker$SelfVisitor
  implements IResourceDeltaVisitor
{
  int type;
  final ManifestConsistencyChecker this$0;
  
  ManifestConsistencyChecker$SelfVisitor(ManifestConsistencyChecker paramManifestConsistencyChecker)
  {
    this$0 = paramManifestConsistencyChecker;
    type = 0;
  }
  
  public boolean visit(IResourceDelta delta)
    throws CoreException
  {
    if ((delta != null) && (type != (ManifestConsistencyChecker.access$0(this$0) | ManifestConsistencyChecker.access$1(this$0) | ManifestConsistencyChecker.access$2(this$0) | ManifestConsistencyChecker.access$3(this$0))))
    {
      int kind = delta.getKind();
      if ((kind == 1) || (kind == 2))
      {
        type = (ManifestConsistencyChecker.access$0(this$0) | ManifestConsistencyChecker.access$1(this$0) | ManifestConsistencyChecker.access$2(this$0) | ManifestConsistencyChecker.access$3(this$0));
        if (ManifestConsistencyChecker.access$4())
        {
          System.out.print("Needs to rebuild project [" + this$0.getProject().getName() + "]: ");
          System.out.print(delta.getResource().getProjectRelativePath().toString());
          System.out.print(" - ");
          System.out.println(kind == 1 ? "added" : "removed");
        }
        return false;
      }
      IResource resource = delta.getResource();
      if (resource.isDerived()) {
        return false;
      }
      if (resource.getType() == 1)
      {
        IFile file = (IFile)resource;
        IProject project = file.getProject();
        String name = resource.getName();
        if (ManifestConsistencyChecker.access$5(this$0, resource))
        {
          type |= ManifestConsistencyChecker.access$0(this$0) | ManifestConsistencyChecker.access$1(this$0);
          if (ManifestConsistencyChecker.access$4())
          {
            System.out.print("Needs to rebuild manifest and extensions in project [" + this$0.getProject().getName() + "]: ");
            System.out.print(delta.getResource().getProjectRelativePath().toString());
            System.out.println(" - changed");
          }
        }
        else if (file.equals(PDEProject.getManifest(project)))
        {
          type |= ManifestConsistencyChecker.access$0(this$0) | ManifestConsistencyChecker.access$1(this$0) | ManifestConsistencyChecker.access$2(this$0);
          if (ManifestConsistencyChecker.access$4())
          {
            System.out.print("Needs to rebuild project [" + this$0.getProject().getName() + "]: ");
            System.out.print(delta.getResource().getProjectRelativePath().toString());
            System.out.println(" - changed");
          }
        }
        else if ((name.endsWith(".exsd")) || (file.equals(PDEProject.getPluginXml(project))) || (file.equals(PDEProject.getFragmentXml(project))))
        {
          type |= ManifestConsistencyChecker.access$1(this$0);
          if (ManifestConsistencyChecker.access$4())
          {
            System.out.print("Needs to rebuild extensions in project [" + this$0.getProject().getName() + "]: ");
            System.out.print(delta.getResource().getProjectRelativePath().toString());
            System.out.println(" - changed");
          }
        }
        else if (file.equals(PDEProject.getBuildProperties(project)))
        {
          type |= ManifestConsistencyChecker.access$2(this$0);
          if (ManifestConsistencyChecker.access$4())
          {
            System.out.print("Needs to rebuild build.properties in project [" + this$0.getProject().getName() + "]: ");
            System.out.print(delta.getResource().getProjectRelativePath().toString());
            System.out.println(" - changed");
          }
        }
      }
    }
    return type != (ManifestConsistencyChecker.access$0(this$0) | ManifestConsistencyChecker.access$1(this$0) | ManifestConsistencyChecker.access$2(this$0) | ManifestConsistencyChecker.access$3(this$0));
  }
  
  public int getType()
  {
    return type;
  }
  
  public void reset()
  {
    type = 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.SelfVisitor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import java.io.File;
import java.io.FilenameFilter;
import java.io.PrintStream;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.PDECoreMessages;
import org.eclipse.pde.internal.core.WorkspaceModelManager;
import org.eclipse.pde.internal.core.project.PDEProject;
import org.osgi.framework.Bundle;

public class ManifestConsistencyChecker
  extends IncrementalProjectBuilder
{
  private int MANIFEST = 1;
  private int EXTENSIONS = 2;
  private int BUILD = 4;
  private int STRUCTURE = 8;
  private static IProject[] EMPTY_LIST = new IProject[0];
  private static boolean DEBUG = (PDECore.getDefault().isDebugging()) && ("true".equals(Platform.getDebugOption("org.eclipse.pde.core/validation")));
  private SelfVisitor fSelfVisitor = new SelfVisitor();
  private ClassChangeVisitor fClassFileVisitor = new ClassChangeVisitor();
  
  class ClassChangeVisitor
    implements IResourceDeltaVisitor
  {
    boolean hasChanged = false;
    boolean veto = false;
    
    ClassChangeVisitor() {}
    
    public boolean visit(IResourceDelta delta)
      throws CoreException
    {
      if ((delta != null) && (!veto))
      {
        int kind = delta.getKind();
        if (kind == 4)
        {
          IResource resource = delta.getResource();
          if ((resource instanceof IFile))
          {
            String extension = resource.getFileExtension();
            if ("java".equals(extension)) {
              veto = true;
            } else if (("class".equals(extension)) && (!hasChanged)) {
              hasChanged = true;
            }
          }
          return !veto;
        }
      }
      return false;
    }
    
    public void reset()
    {
      veto = false;
      hasChanged = false;
    }
    
    public boolean hasChanged()
    {
      return (hasChanged) && (!veto);
    }
  }
  
  class SelfVisitor
    implements IResourceDeltaVisitor
  {
    int type = 0;
    
    SelfVisitor() {}
    
    public boolean visit(IResourceDelta delta)
      throws CoreException
    {
      if ((delta != null) && (type != (MANIFEST | EXTENSIONS | BUILD | STRUCTURE)))
      {
        int kind = delta.getKind();
        if ((kind == 1) || (kind == 2))
        {
          type = (MANIFEST | EXTENSIONS | BUILD | STRUCTURE);
          if (ManifestConsistencyChecker.DEBUG)
          {
            System.out.print("Needs to rebuild project [" + getProject().getName() + "]: ");
            System.out.print(delta.getResource().getProjectRelativePath().toString());
            System.out.print(" - ");
            System.out.println(kind == 1 ? "added" : "removed");
          }
          return false;
        }
        IResource resource = delta.getResource();
        if (resource.isDerived()) {
          return false;
        }
        if (resource.getType() == 1)
        {
          IFile file = (IFile)resource;
          IProject project = file.getProject();
          String name = resource.getName();
          if (ManifestConsistencyChecker.this.isLocalizationFile(resource))
          {
            type |= MANIFEST | EXTENSIONS;
            if (ManifestConsistencyChecker.DEBUG)
            {
              System.out.print("Needs to rebuild manifest and extensions in project [" + getProject().getName() + "]: ");
              System.out.print(delta.getResource().getProjectRelativePath().toString());
              System.out.println(" - changed");
            }
          }
          else if (file.equals(PDEProject.getManifest(project)))
          {
            type |= MANIFEST | EXTENSIONS | BUILD;
            if (ManifestConsistencyChecker.DEBUG)
            {
              System.out.print("Needs to rebuild project [" + getProject().getName() + "]: ");
              System.out.print(delta.getResource().getProjectRelativePath().toString());
              System.out.println(" - changed");
            }
          }
          else if ((name.endsWith(".exsd")) || (file.equals(PDEProject.getPluginXml(project))) || (file.equals(PDEProject.getFragmentXml(project))))
          {
            type |= EXTENSIONS;
            if (ManifestConsistencyChecker.DEBUG)
            {
              System.out.print("Needs to rebuild extensions in project [" + getProject().getName() + "]: ");
              System.out.print(delta.getResource().getProjectRelativePath().toString());
              System.out.println(" - changed");
            }
          }
          else if (file.equals(PDEProject.getBuildProperties(project)))
          {
            type |= BUILD;
            if (ManifestConsistencyChecker.DEBUG)
            {
              System.out.print("Needs to rebuild build.properties in project [" + getProject().getName() + "]: ");
              System.out.print(delta.getResource().getProjectRelativePath().toString());
              System.out.println(" - changed");
            }
          }
        }
      }
      return type != (MANIFEST | EXTENSIONS | BUILD | STRUCTURE);
    }
    
    public int getType()
    {
      return type;
    }
    
    public void reset()
    {
      type = 0;
    }
  }
  
  private boolean isLocalizationFile(IResource file)
  {
    return file.equals(PDEProject.getLocalizationFile(getProject()));
  }
  
  protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
    throws CoreException
  {
    if ((PDECore.getDefault().getBundle().getState() != 32) || (monitor.isCanceled())) {
      return EMPTY_LIST;
    }
    IProject project = getProject();
    if (!WorkspaceModelManager.isBinaryProject(project))
    {
      int type = getDeltaType(project);
      if (type != 0) {
        validateProject(type, monitor);
      }
    }
    return EMPTY_LIST;
  }
  
  private int getDeltaType(IProject project)
    throws CoreException
  {
    IResourceDelta delta = getDelta(project);
    if (delta == null)
    {
      if (DEBUG) {
        System.out.println("Project [" + getProject().getName() + "] - full build");
      }
      return MANIFEST | EXTENSIONS | BUILD | STRUCTURE;
    }
    if (Boolean.TRUE.equals(project.getSessionProperty(PDECore.TOUCH_PROJECT)))
    {
      project.setSessionProperty(PDECore.TOUCH_PROJECT, null);
      if (DEBUG) {
        System.out.println("Dependencies Changed: Project [" + getProject().getName() + "] - full build");
      }
      return MANIFEST | EXTENSIONS | BUILD;
    }
    fSelfVisitor.reset();
    delta.accept(fSelfVisitor);
    int type = fSelfVisitor.getType();
    if ((type & MANIFEST | EXTENSIONS) != (MANIFEST | EXTENSIONS))
    {
      fClassFileVisitor.reset();
      delta.accept(fClassFileVisitor);
      if (fClassFileVisitor.hasChanged())
      {
        type |= MANIFEST | EXTENSIONS | BUILD;
        if (DEBUG) {
          System.out.println("Class files changed due to dependency changes: Project [" + getProject().getName() + "] - rebuild manifest and properties files");
        }
      }
    }
    return type;
  }
  
  private void validateProject(int type, IProgressMonitor monitor)
  {
    monitor.beginTask(PDECoreMessages.ManifestConsistencyChecker_builderTaskName, getWorkAmount(type));
    if ((type & STRUCTURE) != 0) {
      validateProjectStructure(type, new SubProgressMonitor(monitor, 1));
    }
    if ((type & MANIFEST | EXTENSIONS) != 0)
    {
      IProject project = getProject();
      IFile file = PDEProject.getPluginXml(project);
      if (!file.exists()) {
        file = PDEProject.getFragmentXml(project);
      }
      if (file.exists())
      {
        validateFiles(file, type, monitor);
      }
      else if ((type & MANIFEST) != 0)
      {
        IFile manifestFile = PDEProject.getManifest(project);
        if (manifestFile.exists()) {
          validateManifestFile(manifestFile, new SubProgressMonitor(monitor, 1));
        }
      }
    }
    if ((type & BUILD) != 0) {
      validateBuildProperties(new SubProgressMonitor(monitor, 1));
    }
  }
  
  private int getWorkAmount(int type)
  {
    int work = 1;
    if ((type & MANIFEST | EXTENSIONS) != 0) {
      work++;
    }
    if ((type & BUILD) != 0) {
      work++;
    }
    return work;
  }
  
  private void validateProjectStructure(int type, IProgressMonitor monitor)
  {
    if (monitor.isCanceled()) {
      return;
    }
    IProject project = getProject();
    try
    {
      project.deleteMarkers("org.eclipse.pde.core.problem", false, 0);
    }
    catch (CoreException localCoreException) {}
    validateBuildPropertiesExists(project);
    
    validateManifestCasing(project);
  }
  
  private void validateManifestFile(IFile file, IProgressMonitor monitor)
  {
    if (monitor.isCanceled()) {
      return;
    }
    String message = NLS.bind(PDECoreMessages.Builders_verifying, file.getFullPath().toString());
    monitor.subTask(message);
    
    BundleErrorReporter reporter = new BundleErrorReporter(file);
    if (reporter != null)
    {
      reporter.validateContent(monitor);
      monitor.subTask(PDECoreMessages.Builders_updating);
    }
    monitor.done();
  }
  
  private void validateFiles(IFile file, int type, IProgressMonitor monitor)
  {
    if (monitor.isCanceled()) {
      return;
    }
    String message = NLS.bind(PDECoreMessages.Builders_verifying, file.getFullPath().toString());
    monitor.subTask(message);
    
    IFile bundleManifest = PDEProject.getManifest(getProject());
    XMLErrorReporter reporter = null;
    BundleErrorReporter bundleReporter = null;
    if (bundleManifest.exists())
    {
      if ((type & EXTENSIONS) != 0) {
        reporter = new ExtensionsErrorReporter(file);
      }
      if ((type & MANIFEST) != 0) {
        bundleReporter = new BundleErrorReporter(bundleManifest);
      }
    }
    else if (((type & MANIFEST) != 0) || ((type & EXTENSIONS) != 0))
    {
      if (file.equals(PDEProject.getPluginXml(getProject()))) {
        reporter = new PluginErrorReporter(file);
      } else if (file.equals(PDEProject.getFragmentXml(getProject()))) {
        reporter = new FragmentErrorReporter(file);
      }
    }
    if (reporter != null)
    {
      DefaultSAXParser.parse(file, reporter);
      reporter.validateContent(monitor);
      monitor.subTask(PDECoreMessages.Builders_updating);
    }
    if (bundleReporter != null)
    {
      bundleReporter.validateContent(monitor);
      monitor.subTask(PDECoreMessages.Builders_updating);
    }
    monitor.done();
  }
  
  private void validateBuildProperties(IProgressMonitor monitor)
  {
    if (monitor.isCanceled()) {
      return;
    }
    IProject project = getProject();
    IFile file = PDEProject.getBuildProperties(project);
    if (file.exists())
    {
      monitor.subTask(PDECoreMessages.ManifestConsistencyChecker_buildPropertiesSubtask);
      BuildErrorReporter ber = new BuildErrorReporter(file);
      ber.validateContent(monitor);
    }
  }
  
  private void validateBuildPropertiesExists(IProject project)
  {
    IFile file = PDEProject.getBuildProperties(project);
    if (!file.exists())
    {
      int severity = CompilerFlags.getFlag(project, "compilers.p.build");
      if (severity == 2) {
        return;
      }
      try
      {
        IMarker marker = project.createMarker("org.eclipse.pde.core.problem");
        marker.setAttribute("severity", severity == 0 ? 2 : 1);
        marker.setAttribute("message", PDECoreMessages.ManifestConsistencyChecker_buildDoesNotExist);
      }
      catch (CoreException localCoreException) {}
    }
  }
  
  private void validateManifestCasing(IProject project)
  {
    IFolder manifestFolder = PDEProject.getMetaInf(project);
    if (manifestFolder.exists())
    {
      try
      {
        manifestFolder.deleteMarkers("org.eclipse.pde.core.problem", false, 1);
      }
      catch (CoreException localCoreException1) {}
      if (PDEProject.getManifest(project).exists()) {
        return;
      }
      IPath location = manifestFolder.getLocation();
      if (location != null)
      {
        File metaFolder = location.toFile();
        String[] fileList = metaFolder.list(new ManifestFilter());
        for (int i = 0; i < fileList.length; i++)
        {
          String fileName = fileList[i];
          IFile currentFile = manifestFolder.getFile(fileName);
          try
          {
            IMarker marker = currentFile.createMarker("org.eclipse.pde.core.problem");
            marker.setAttribute("severity", 2);
            marker.setAttribute("message", PDECoreMessages.ManifestConsistencyChecker_manifestMisspelled);
          }
          catch (CoreException localCoreException2) {}
        }
        if (fileList.length == 0) {
          try
          {
            IMarker marker = project.createMarker("org.eclipse.pde.core.problem");
            marker.setAttribute("severity", 2);
            marker.setAttribute("message", PDECoreMessages.ManifestConsistencyChecker_manifestDoesNotExist);
          }
          catch (CoreException localCoreException3) {}
        }
      }
    }
  }
  
  /* Error */
  protected void clean(IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload_1
    //   1: getstatic 366	org/eclipse/pde/internal/core/PDECoreMessages:ManifestConsistencyChecker_0	Ljava/lang/String;
    //   4: aload_0
    //   5: invokevirtual 407	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:getProject	()Lorg/eclipse/core/resources/IProject;
    //   8: invokeinterface 445 1 0
    //   13: invokestatic 393	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   16: iconst_1
    //   17: invokestatic 391	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;I)Lorg/eclipse/core/runtime/SubMonitor;
    //   20: astore_2
    //   21: aload_0
    //   22: aload_0
    //   23: invokevirtual 407	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:getProject	()Lorg/eclipse/core/resources/IProject;
    //   26: iconst_0
    //   27: invokespecial 412	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:cleanProblems	(Lorg/eclipse/core/resources/IResource;I)V
    //   30: aload_0
    //   31: invokevirtual 407	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:getProject	()Lorg/eclipse/core/resources/IProject;
    //   34: invokestatic 431	org/eclipse/pde/internal/core/project/PDEProject:getManifest	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/core/resources/IFile;
    //   37: astore_3
    //   38: aload_0
    //   39: aload_3
    //   40: invokeinterface 436 1 0
    //   45: iconst_1
    //   46: invokespecial 412	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:cleanProblems	(Lorg/eclipse/core/resources/IResource;I)V
    //   49: aload_0
    //   50: aload_0
    //   51: invokevirtual 407	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:getProject	()Lorg/eclipse/core/resources/IProject;
    //   54: invokestatic 432	org/eclipse/pde/internal/core/project/PDEProject:getPluginXml	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/core/resources/IFile;
    //   57: iconst_0
    //   58: invokespecial 412	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:cleanProblems	(Lorg/eclipse/core/resources/IResource;I)V
    //   61: aload_0
    //   62: aload_0
    //   63: invokevirtual 407	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:getProject	()Lorg/eclipse/core/resources/IProject;
    //   66: invokestatic 429	org/eclipse/pde/internal/core/project/PDEProject:getFragmentXml	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/core/resources/IFile;
    //   69: iconst_0
    //   70: invokespecial 412	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:cleanProblems	(Lorg/eclipse/core/resources/IResource;I)V
    //   73: aload_0
    //   74: aload_0
    //   75: invokevirtual 407	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:getProject	()Lorg/eclipse/core/resources/IProject;
    //   78: invokestatic 428	org/eclipse/pde/internal/core/project/PDEProject:getBuildProperties	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/core/resources/IFile;
    //   81: iconst_0
    //   82: invokespecial 412	org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker:cleanProblems	(Lorg/eclipse/core/resources/IResource;I)V
    //   85: aload_2
    //   86: iconst_1
    //   87: invokevirtual 390	org/eclipse/core/runtime/SubMonitor:worked	(I)V
    //   90: goto +12 -> 102
    //   93: astore 4
    //   95: aload_2
    //   96: invokevirtual 389	org/eclipse/core/runtime/SubMonitor:done	()V
    //   99: aload 4
    //   101: athrow
    //   102: aload_2
    //   103: invokevirtual 389	org/eclipse/core/runtime/SubMonitor:done	()V
    //   106: return
    // Line number table:
    //   Java source line #390	-> byte code offset #0
    //   Java source line #393	-> byte code offset #21
    //   Java source line #395	-> byte code offset #30
    //   Java source line #396	-> byte code offset #38
    //   Java source line #398	-> byte code offset #49
    //   Java source line #400	-> byte code offset #61
    //   Java source line #402	-> byte code offset #73
    //   Java source line #403	-> byte code offset #85
    //   Java source line #404	-> byte code offset #93
    //   Java source line #405	-> byte code offset #95
    //   Java source line #406	-> byte code offset #99
    //   Java source line #405	-> byte code offset #102
    //   Java source line #407	-> byte code offset #106
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	107	0	this	ManifestConsistencyChecker
    //   0	107	1	monitor	IProgressMonitor
    //   20	83	2	localmonitor	org.eclipse.core.runtime.SubMonitor
    //   37	3	3	manifestFile	IFile
    //   93	7	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   21	93	93	finally
  }
  
  class ManifestFilter
    implements FilenameFilter
  {
    ManifestFilter() {}
    
    public boolean accept(File dir, String name)
    {
      return name.equalsIgnoreCase("MANIFEST.MF");
    }
  }
  
  private void cleanProblems(IResource resource, int depth)
    throws CoreException
  {
    if (resource.exists()) {
      resource.deleteMarkers("org.eclipse.pde.core.problem", true, depth);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import java.util.ArrayList;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

class ManifestErrorReporter$1$NodeListImpl
  implements NodeList
{
  ArrayList nodes;
  final ManifestErrorReporter this$0;
  
  ManifestErrorReporter$1$NodeListImpl(ManifestErrorReporter paramManifestErrorReporter)
  {
    this$0 = paramManifestErrorReporter;
    nodes = new ArrayList();
  }
  
  public int getLength()
  {
    return nodes.size();
  }
  
  public Node item(int index)
  {
    return (Node)nodes.get(index);
  }
  
  protected void add(Node node)
  {
    nodes.add(node);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.ManifestErrorReporter.1.NodeListImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.internal.core.PDECoreMessages;
import org.eclipse.pde.internal.core.util.IdUtil;
import org.eclipse.pde.internal.core.util.VersionUtil;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;

public class ManifestErrorReporter
  extends XMLErrorReporter
{
  public ManifestErrorReporter(IFile file)
  {
    super(file);
  }
  
  protected void reportIllegalElement(Element element, int severity)
  {
    Node parent = element.getParentNode();
    if ((parent == null) || ((parent instanceof Document))) {
      report(PDECoreMessages.Builders_Manifest_illegalRoot, getLine(element), severity, "fatal");
    } else {
      report(NLS.bind(PDECoreMessages.Builders_Manifest_child, new String[] { element.getNodeName(), parent.getNodeName() }), getLine(element), severity, 12289, element, null, "fatal");
    }
  }
  
  protected void reportMissingRequiredAttribute(Element element, String attName, int severity)
  {
    String message = NLS.bind(PDECoreMessages.Builders_Manifest_missingRequired, new String[] { attName, element.getNodeName() });
    report(message, getLine(element), severity, "fatal");
  }
  
  protected boolean assertAttributeDefined(Element element, String attrName, int severity)
  {
    Attr attr = element.getAttributeNode(attrName);
    if (attr == null)
    {
      reportMissingRequiredAttribute(element, attrName, severity);
      return false;
    }
    return true;
  }
  
  protected void reportUnknownAttribute(Element element, String attName, int severity)
  {
    String message = NLS.bind(PDECoreMessages.Builders_Manifest_attribute, attName);
    report(message, getLine(element, attName), severity, 12289, element, attName, "");
  }
  
  protected void reportIllegalAttributeValue(Element element, Attr attr)
  {
    String message = NLS.bind(PDECoreMessages.Builders_Manifest_att_value, new String[] { attr.getValue(), attr.getName() });
    report(message, getLine(element, attr.getName()), 0, "fatal");
  }
  
  protected void validateVersionAttribute(Element element, Attr attr)
  {
    IStatus status = VersionUtil.validateVersion(attr.getValue());
    if (status.getSeverity() != 0) {
      report(status.getMessage(), getLine(element, attr.getName()), 0, "fatal");
    }
  }
  
  protected void validateMatch(Element element, Attr attr)
  {
    String value = attr.getValue();
    if ((!"perfect".equals(value)) && (!"equivalent".equals(value)) && 
      (!"greaterOrEqual".equals(value)) && (!"compatible".equals(value))) {
      reportIllegalAttributeValue(element, attr);
    }
  }
  
  protected void validateElementWithContent(Element element, boolean hasContent)
  {
    NodeList children = element.getChildNodes();
    boolean textFound = false;
    for (int i = 0; i < children.getLength(); i++)
    {
      Node child = children.item(i);
      if ((child instanceof Text)) {
        textFound = ((Text)child).getNodeValue().trim().length() > 0;
      } else if ((child instanceof Element)) {
        reportIllegalElement((Element)child, 0);
      }
    }
    if (!textFound) {
      reportMissingElementContent(element);
    }
  }
  
  private void reportMissingElementContent(Element element)
  {
    report(NLS.bind(PDECoreMessages.Builders_Feature_empty, element.getNodeName()), getLine(element), 0, "fatal");
  }
  
  protected void reportExtraneousElements(NodeList elements, int maximum)
  {
    if (elements.getLength() > maximum) {
      for (int i = maximum; i < elements.getLength(); i++)
      {
        Element element = (Element)elements.item(i);
        report(NLS.bind(PDECoreMessages.Builders_Feature_multiplicity, element.getNodeName()), getLine(element), 0, "fatal");
      }
    }
  }
  
  protected void validateURL(Element element, String attName)
  {
    String value = element.getAttribute(attName);
    try
    {
      if ((!value.startsWith("http:")) && (!value.startsWith("file:"))) {
        value = "file:" + value;
      }
      new URL(value);
    }
    catch (MalformedURLException localMalformedURLException)
    {
      report(NLS.bind(PDECoreMessages.Builders_Feature_badURL, attName), getLine(element, attName), 0, "fatal");
    }
  }
  
  protected boolean validatePluginID(Element element, Attr attr)
  {
    if (!IdUtil.isValidCompositeID3_0(attr.getValue()))
    {
      String message = NLS.bind(PDECoreMessages.Builders_Manifest_compositeID, attr.getValue(), attr.getName());
      report(message, getLine(element, attr.getName()), 1, "");
      return false;
    }
    return true;
  }
  
  protected void validateBoolean(Element element, Attr attr)
  {
    String value = attr.getValue();
    if ((!value.equalsIgnoreCase("true")) && (!value.equalsIgnoreCase("false"))) {
      reportIllegalAttributeValue(element, attr);
    }
  }
  
  class 1$NodeListImpl
    implements NodeList
  {
    ArrayList nodes = new ArrayList();
    
    1$NodeListImpl() {}
    
    public int getLength()
    {
      return nodes.size();
    }
    
    public Node item(int index)
    {
      return (Node)nodes.get(index);
    }
    
    protected void add(Node node)
    {
      nodes.add(node);
    }
  }
  
  protected NodeList getChildrenByName(Element element, String name)
  {
    1.NodeListImpl list = new 1.NodeListImpl();
    NodeList allChildren = element.getChildNodes();
    for (int i = 0; i < allChildren.getLength(); i++)
    {
      Node node = allChildren.item(i);
      if (name.equals(node.getNodeName())) {
        list.add(node);
      }
    }
    return list;
  }
  
  protected void reportDeprecatedAttribute(Element element, Attr attr)
  {
    int severity = CompilerFlags.getFlag(fProject, "compilers.p.deprecated");
    if (severity != 2) {
      report(NLS.bind(PDECoreMessages.Builders_Manifest_deprecated_attribute, attr.getName()), getLine(element, attr.getName()), severity, "deprecation");
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.ManifestErrorReporter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.pde.core.build.IBuild;
import org.eclipse.pde.core.build.IBuildEntry;

public class PDEBuilderHelper
{
  public static String[] getUnlistedClasspaths(ArrayList sourceEntries, IProject project, IClasspathEntry[] cpes)
  {
    String[] unlisted = new String[cpes.length];
    int index = 0;
    for (int i = 0; i < cpes.length; i++) {
      if (cpes[i].getEntryKind() == 3)
      {
        IPath path = cpes[i].getPath();
        boolean found = false;
        for (int j = 0; j < sourceEntries.size(); j++)
        {
          IBuildEntry be = (IBuildEntry)sourceEntries.get(j);
          String[] tokens = be.getTokens();
          for (int k = 0; k < tokens.length; k++)
          {
            IResource res = project.findMember(tokens[k]);
            if (res != null)
            {
              IPath ipath = res.getFullPath();
              if (ipath.equals(path)) {
                found = true;
              }
            }
          }
        }
        if (!found) {
          unlisted[(index++)] = path.removeFirstSegments(1).addTrailingSeparator().toString();
        }
      }
    }
    return unlisted;
  }
  
  public static ArrayList getSourceEntries(IBuild build)
  {
    ArrayList sourceEntryKeys = new ArrayList();
    IBuildEntry[] entries = build.getBuildEntries();
    for (int i = 0; i < entries.length; i++)
    {
      String name = entries[i].getName();
      if (name.startsWith("source."))
      {
        String entry = name.substring("source.".length(), name.length());
        sourceEntryKeys.add(entry);
      }
    }
    return sourceEntryKeys;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.builders.PDEBuilderHelper
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.builders;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;

public class PDEMarkerFactory
{
  public static final String MARKER_ID = "org.eclipse.pde.core.problem";
  public static final int NO_RESOLUTION = -1;
  public static final int M_DEPRECATED_AUTOSTART = 4097;
  public static final int M_JAVA_PACKAGE__PORTED = 4098;
  public static final int M_SINGLETON_DIR_NOT_SET = 4099;
  public static final int M_SINGLETON_ATT_NOT_SET = 4100;
  public static final int M_PROJECT_BUILD_ORDER_ENTRIES = 4101;
  public static final int M_EXPORT_PKG_NOT_EXIST = 4102;
  public static final int M_IMPORT_PKG_NOT_AVAILABLE = 4103;
  public static final int M_REQ_BUNDLE_NOT_AVAILABLE = 4104;
  public static final int M_UNKNOWN_CLASS = 4105
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

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-2019. Infinite Loop Ltd