org.eclipse.jdt.core.manipulation_1.4.0.v20110928-1453

 update;
  }
  
  public void setUpdateQualifiedNames(boolean update)
  {
    fQualified = update;
  }
  
  public void setUpdateReferences(boolean update)
  {
    fReferences = update;
  }
  
  public void setUpdateSimilarDeclarations(boolean update)
  {
    fSimilarDeclarations = update;
  }
  
  public void setUpdateTextualOccurrences(boolean update)
  {
    fTextual = update;
  }
  
  public RefactoringStatus validateDescriptor()
  {
    RefactoringStatus status = super.validateDescriptor();
    if ((fName == null) || ("".equals(fName))) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameResourceDescriptor_no_new_name));
    }
    if (fJavaElement == null)
    {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_no_java_element));
    }
    else
    {
      int type = fJavaElement.getElementType();
      if ((type == 2) && (getProject() != null)) {
        status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_project_constraint));
      }
      if ((type == 3) && (fReferences)) {
        status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_reference_constraint));
      }
      if (fTextual) {
        switch (type)
        {
        case 4: 
        case 7: 
        case 8: 
          break;
        case 5: 
        case 6: 
        default: 
          status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_textual_constraint));
        }
      }
      if (fDeprecate) {
        switch (type)
        {
        case 8: 
        case 9: 
          break;
        default: 
          status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_deprecation_constraint));
        }
      }
      if (fDelegate) {
        switch (type)
        {
        case 8: 
        case 9: 
          break;
        default: 
          status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_delegate_constraint));
        }
      }
      if (((fRenameGetter) || (fRenameSetter)) && 
        (type != 8)) {
        status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_accessor_constraint));
      }
      if (fQualified) {
        switch (type)
        {
        case 4: 
        case 7: 
          break;
        case 5: 
        case 6: 
        default: 
          status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_qualified_constraint));
        }
      }
      if (fSimilarDeclarations) {
        switch (type)
        {
        case 7: 
          break;
        default: 
          status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_similar_constraint));
        }
      }
      if (fHierarchical) {
        switch (type)
        {
        case 4: 
          break;
        default: 
          status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameJavaElementDescriptor_hierarchical_constraint));
        }
      }
    }
    return status;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.descriptors;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.internal.core.refactoring.descriptors.DescriptorMessages;
import org.eclipse.jdt.internal.core.refactoring.descriptors.JavaRefactoringDescriptorUtil;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;

/**
 * @deprecated
 */
public final class RenameLocalVariableDescriptor
  extends JavaRefactoringDescriptor
{
  private String fName = null;
  private boolean fReferences = false;
  private ISourceRange fSelection = null;
  private ICompilationUnit fUnit = null;
  
  /**
   * @deprecated
   */
  public RenameLocalVariableDescriptor()
  {
    super("org.eclipse.jdt.ui.rename.local.variable");
  }
  
  protected void populateArgumentMap()
  {
    super.populateArgumentMap();
    JavaRefactoringDescriptorUtil.setString(fArguments, "name", fName);
    JavaRefactoringDescriptorUtil.setJavaElement(fArguments, "input", getProject(), fUnit);
    JavaRefactoringDescriptorUtil.setSelection(fArguments, "selection", fSelection.getOffset(), fSelection.getLength());
    JavaRefactoringDescriptorUtil.setBoolean(fArguments, "references", fReferences);
  }
  
  public void setCompilationUnit(ICompilationUnit unit)
  {
    Assert.isNotNull(unit);
    fUnit = unit;
  }
  
  public void setNewName(String name)
  {
    Assert.isNotNull(name);
    Assert.isLegal(!"".equals(name), "Name must not be empty");
    fName = name;
  }
  
  public void setSelection(ISourceRange selection)
  {
    Assert.isNotNull(selection);
    fSelection = selection;
  }
  
  public void setUpdateReferences(boolean update)
  {
    fReferences = update;
  }
  
  public RefactoringStatus validateDescriptor()
  {
    RefactoringStatus status = super.validateDescriptor();
    if ((fName == null) || ("".equals(fName))) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameResourceDescriptor_no_new_name));
    }
    if (fUnit == null) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameLocalVariableDescriptor_no_compilation_unit));
    }
    if (fSelection == null) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameLocalVariableDescriptor_no_selection));
    }
    return status;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.descriptors.RenameLocalVariableDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.descriptors;

import java.util.Map;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.internal.core.refactoring.descriptors.DescriptorMessages;
import org.eclipse.jdt.internal.core.refactoring.descriptors.JavaRefactoringDescriptorUtil;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;

/**
 * @deprecated
 */
public final class RenameResourceDescriptor
  extends JavaRefactoringDescriptor
{
  private String fName = null;
  private IPath fResourcePath = null;
  
  public RenameResourceDescriptor()
  {
    super("org.eclipse.jdt.ui.rename.resource");
  }
  
  public RenameResourceDescriptor(String project, String description, String comment, Map arguments, int flags)
  {
    super("org.eclipse.jdt.ui.rename.resource", project, description, comment, arguments, flags);
    fResourcePath = JavaRefactoringDescriptorUtil.getResourcePath(arguments, "input", project);
    fName = JavaRefactoringDescriptorUtil.getString(arguments, "name");
  }
  
  protected void populateArgumentMap()
  {
    super.populateArgumentMap();
    JavaRefactoringDescriptorUtil.setResourcePath(fArguments, "input", getProject(), fResourcePath);
    JavaRefactoringDescriptorUtil.setString(fArguments, "name", fName);
  }
  
  public void setNewName(String name)
  {
    Assert.isNotNull(name);
    Assert.isLegal(!"".equals(name), "Name must not be empty");
    fName = name;
  }
  
  public String getNewName()
  {
    return fName;
  }
  
  public void setProject(String project)
  {
    super.setProject(project);
  }
  
  public void setResource(IResource resource)
  {
    Assert.isNotNull(resource);
    fResourcePath = resource.getFullPath();
  }
  
  public IPath getResourcePath()
  {
    return fResourcePath;
  }
  
  public RefactoringStatus validateDescriptor()
  {
    RefactoringStatus status = super.validateDescriptor();
    if (fResourcePath == null) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameResourceDescriptor_no_resource));
    }
    if ((fName == null) || ("".equals(fName))) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameResourceDescriptor_no_new_name));
    }
    if ((fResourcePath.segmentCount() == 1) && (getProject() != null)) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.RenameResourceDescriptor_project_constraint));
    }
    return status;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.descriptors.RenameResourceDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.descriptors;

import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.core.refactoring.descriptors.DescriptorMessages;
import org.eclipse.jdt.internal.core.refactoring.descriptors.JavaRefactoringDescriptorUtil;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;

public final class UseSupertypeDescriptor
  extends JavaRefactoringDescriptor
{
  private static final String ATTRIBUTE_INSTANCEOF = "instanceof";
  private boolean fInstanceof = false;
  private IType fSubType = null;
  private IType fSupertype = null;
  
  public UseSupertypeDescriptor()
  {
    super("org.eclipse.jdt.ui.use.supertype");
  }
  
  public UseSupertypeDescriptor(String project, String description, String comment, Map arguments, int flags)
  {
    super("org.eclipse.jdt.ui.use.supertype", project, description, comment, arguments, flags);
    fInstanceof = JavaRefactoringDescriptorUtil.getBoolean(arguments, "instanceof", fInstanceof);
    fSubType = ((IType)JavaRefactoringDescriptorUtil.getJavaElement(arguments, "input", project));
    fSupertype = ((IType)JavaRefactoringDescriptorUtil.getJavaElement(arguments, JavaRefactoringDescriptorUtil.getAttributeName("element", 1), project));
  }
  
  protected void populateArgumentMap()
  {
    super.populateArgumentMap();
    JavaRefactoringDescriptorUtil.setBoolean(fArguments, "instanceof", fInstanceof);
    JavaRefactoringDescriptorUtil.setJavaElement(fArguments, "input", getProject(), fSubType);
    JavaRefactoringDescriptorUtil.setJavaElement(fArguments, JavaRefactoringDescriptorUtil.getAttributeName("element", 1), getProject(), fSupertype);
  }
  
  public void setReplaceInstanceof(boolean replace)
  {
    fInstanceof = replace;
  }
  
  public void setSubtype(IType type)
  {
    Assert.isNotNull(type);
    fSubType = type;
  }
  
  public void setSupertype(IType type)
  {
    Assert.isNotNull(type);
    fSupertype = type;
  }
  
  public RefactoringStatus validateDescriptor()
  {
    RefactoringStatus status = super.validateDescriptor();
    if (fSubType == null) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.UseSupertypeDescriptor_no_subtype));
    }
    if (fSupertype == null) {
      status.merge(RefactoringStatus.createFatalErrorStatus(DescriptorMessages.UseSupertypeDescriptor_no_supertype));
    }
    return status;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.descriptors.UseSupertypeDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.participants;

public final class ChangeMethodSignatureArguments$Parameter
{
  private final int fOldIndex;
  private final String fNewName;
  private final String fNewSignature;
  private final String fDefaultValue;
  
  public ChangeMethodSignatureArguments$Parameter(int oldIndex, String newName, String newSignature, String defaultValue)
  {
    fOldIndex = oldIndex;
    fNewName = newName;
    fNewSignature = newSignature;
    fDefaultValue = defaultValue;
  }
  
  public int getOldIndex()
  {
    return fOldIndex;
  }
  
  public String getName()
  {
    return fNewName;
  }
  
  public String getType()
  {
    return fNewSignature;
  }
  
  public String getDefaultValue()
  {
    return fDefaultValue;
  }
  
  public String toString()
  {
    return "name: " + fNewName + ", type: " + fNewSignature + ", oldIndex: " + fOldIndex + ", defaultValue: " + fDefaultValue;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.participants.ChangeMethodSignatureArguments.Parameter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.participants;

public final class ChangeMethodSignatureArguments$ThrownException
{
  private final int fOldIndex;
  private final String fType;
  
  public ChangeMethodSignatureArguments$ThrownException(int oldIndex, String newSignature)
  {
    fOldIndex = oldIndex;
    fType = newSignature;
  }
  
  public int getOldIndex()
  {
    return fOldIndex;
  }
  
  public String getType()
  {
    return fType;
  }
  
  public String toString()
  {
    return "type: " + fType + ", oldIndex: " + fOldIndex;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.participants.ChangeMethodSignatureArguments.ThrownException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.participants;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jdt.core.Flags;
import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;

public class ChangeMethodSignatureArguments
  extends RefactoringArguments
{
  private String fNewName;
  private String fNewReturnType;
  private final int fNewVisibility;
  private final Parameter[] fNewParameters;
  private final ThrownException[] fThrownExceptions;
  private final boolean fKeepOriginal;
  
  public static final class Parameter
  {
    private final int fOldIndex;
    private final String fNewName;
    private final String fNewSignature;
    private final String fDefaultValue;
    
    public Parameter(int oldIndex, String newName, String newSignature, String defaultValue)
    {
      fOldIndex = oldIndex;
      fNewName = newName;
      fNewSignature = newSignature;
      fDefaultValue = defaultValue;
    }
    
    public int getOldIndex()
    {
      return fOldIndex;
    }
    
    public String getName()
    {
      return fNewName;
    }
    
    public String getType()
    {
      return fNewSignature;
    }
    
    public String getDefaultValue()
    {
      return fDefaultValue;
    }
    
    public String toString()
    {
      return "name: " + fNewName + ", type: " + fNewSignature + ", oldIndex: " + fOldIndex + ", defaultValue: " + fDefaultValue;
    }
  }
  
  public static final class ThrownException
  {
    private final int fOldIndex;
    private final String fType;
    
    public ThrownException(int oldIndex, String newSignature)
    {
      fOldIndex = oldIndex;
      fType = newSignature;
    }
    
    public int getOldIndex()
    {
      return fOldIndex;
    }
    
    public String getType()
    {
      return fType;
    }
    
    public String toString()
    {
      return "type: " + fType + ", oldIndex: " + fOldIndex;
    }
  }
  
  public ChangeMethodSignatureArguments(String newName, String newReturnType, int newVisibility, Parameter[] newParameters, ThrownException[] thrownExceptions, boolean keepOriginal)
  {
    Assert.isNotNull(newName);
    fNewName = newName;
    fNewReturnType = newReturnType;
    fNewVisibility = newVisibility;
    fNewParameters = newParameters;
    fThrownExceptions = thrownExceptions;
    fKeepOriginal = keepOriginal;
  }
  
  public String getNewName()
  {
    return fNewName;
  }
  
  public String getNewReturnType()
  {
    return fNewReturnType;
  }
  
  public int getNewVisibility()
  {
    return fNewVisibility;
  }
  
  public Parameter[] getNewParameters()
  {
    return fNewParameters;
  }
  
  public ThrownException[] getThrownExceptions()
  {
    return fThrownExceptions;
  }
  
  public boolean getKeepOriginal()
  {
    return fKeepOriginal;
  }
  
  public String toString()
  {
    StringBuffer buf = new StringBuffer("change signature to ");
    buf.append("\n\tvisibility: ").append(Flags.toString(fNewVisibility));
    buf.append("\n\treturn type sig: ").append(fNewReturnType);
    buf.append("\n\tnew name: ").append(fNewName);
    buf.append("\n\tkeep original: ").append(fKeepOriginal);
    for (int i = 0; i < fNewParameters.length; i++) {
      buf.append("\n\tparameter ").append(i).append(": ").append(fNewParameters[i]);
    }
    for (int i = 0; i < fThrownExceptions.length; i++) {
      buf.append("\n\texception ").append(i).append(": ").append(fThrownExceptions[i]);
    }
    return buf.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.participants.ChangeMethodSignatureArguments
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.participants;

import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;

public abstract class ChangeMethodSignatureParticipant
  extends RefactoringParticipant
{
  private ChangeMethodSignatureArguments fArguments;
  
  protected final void initialize(RefactoringArguments arguments)
  {
    fArguments = ((ChangeMethodSignatureArguments)arguments);
  }
  
  public ChangeMethodSignatureArguments getArguments()
  {
    return fArguments;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.participants.ChangeMethodSignatureParticipant
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.participants;

public abstract interface IRefactoringProcessorIds
{
  public static final String CHANGE_METHOD_SIGNATURE_PROCESSOR = "org.eclipse.jdt.ui.changeMethodSignatureRefactoring";
  public static final String INTRODUCE_PARAMETER_OBJECT_PROCESSOR = "org.eclipse.jdt.ui.introduceParameterObjectRefactoring";
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.participants.IRefactoringProcessorIds
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.refactoring.participants;

import org.eclipse.jdt.core.IMethod;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.IParticipantDescriptorFilter;
import org.eclipse.ltk.core.refactoring.participants.ParticipantExtensionPoint;
import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;

public class JavaParticipantManager
{
  private static final String PLUGIN_ID = "org.eclipse.jdt.core.manipulation";
  private static final String METHOD_SIGNATURE_PARTICIPANT_EXT_POINT = "changeMethodSignatureParticipants";
  private static ParticipantExtensionPoint fgMethodSignatureInstance = new ParticipantExtensionPoint("org.eclipse.jdt.core.manipulation", "changeMethodSignatureParticipants", ChangeMethodSignatureParticipant.class);
  
  public static ChangeMethodSignatureParticipant[] loadChangeMethodSignatureParticipants(RefactoringStatus status, RefactoringProcessor processor, IMethod method, ChangeMethodSignatureArguments arguments, IParticipantDescriptorFilter filter, String[] affectedNatures, SharableParticipants shared)
  {
    RefactoringParticipant[] participants = fgMethodSignatureInstance.getParticipants(status, processor, method, arguments, filter, affectedNatures, shared);
    ChangeMethodSignatureParticipant[] result = new ChangeMethodSignatureParticipant[participants.length];
    System.arraycopy(participants, 0, result, 0, participants.length);
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.refactoring.participants.JavaParticipantManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.core.manipulation;

public abstract interface IStatusConstants
{
  public static final int INTERNAL_ERROR = 10001;
}

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

import java.util.regex.Pattern;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;

public class JavaElementPropertyTester
  extends PropertyTester
{
  public static final String NAME = "name";
  public static final String IS_IN_JAVA_PROJECT = "isInJavaProject";
  public static final String IS_IN_JAVA_PROJECT_WITH_NATURE = "isInJavaProjectWithNature";
  public static final String IS_ON_CLASSPATH = "isOnClasspath";
  public static final String HAS_TYPE_ON_CLASSPATH = "hasTypeOnClasspath";
  public static final String IN_SOURCE_FOLDER = "inSourceFolder";
  public static final String IN_ARCHIVE = "inArchive";
  public static final String IN_EXTERNAL_ARCHIVE = "inExternalArchive";
  public static final String PROJECT_OPTION = "projectOption";
  
  public boolean test(Object receiver, String method, Object[] args, Object expectedValue)
  {
    if (!(receiver instanceof IJavaElement)) {
      return false;
    }
    IJavaElement res = (IJavaElement)receiver;
    if (method.equals("name")) {
      return Pattern.matches(toString(expectedValue), res.getElementName());
    }
    if (method.equals("isInJavaProject"))
    {
      IJavaProject javaProject = res.getJavaProject();
      return (javaProject != null) && (javaProject.exists()) && (javaProject.getProject().isOpen());
    }
    if (method.equals("isInJavaProjectWithNature"))
    {
      IJavaProject javaProject = res.getJavaProject();
      if ((javaProject != null) && (javaProject.exists()) && (javaProject.getProject().isOpen()) && 
        (expectedValue != null)) {
        try
        {
          return javaProject.getProject().hasNature(toString(expectedValue));
        }
        catch (CoreException localCoreException)
        {
          return false;
        }
      }
      return false;
    }
    if (method.equals("isOnClasspath"))
    {
      IJavaProject javaProject = res.getJavaProject();
      if ((javaProject != null) && (javaProject.exists())) {
        return javaProject.isOnClasspath(res);
      }
      return false;
    }
    if (method.equals("inSourceFolder"))
    {
      IJavaElement root = res.getAncestor(3);
      if (root != null) {
        try
        {
          return ((IPackageFragmentRoot)root).getKind() == 1;
        }
        catch (JavaModelException localJavaModelException1) {}
      }
      return false;
    }
    if (method.equals("inArchive"))
    {
      IJavaElement root = res.getAncestor(3);
      if (root != null) {
        return ((IPackageFragmentRoot)root).isArchive();
      }
      return false;
    }
    if (method.equals("inExternalArchive"))
    {
      IJavaElement root = res.getAncestor(3);
      if (root != null) {
        return ((IPackageFragmentRoot)root).isExternal();
      }
      return false;
    }
    if (method.equals("projectOption"))
    {
      IJavaProject project = res.getJavaProject();
      if (project != null)
      {
        if (args.length == 2)
        {
          String current = project.getOption(toString(args[0]), true);
          return (current != null) && (current.equals(args[1]));
        }
        if (args.length == 1) {
          return project.getOption(toString(args[0]), false) != null;
        }
      }
      return false;
    }
    if (method.equals("hasTypeOnClasspath"))
    {
      IJavaProject javaProject = res.getJavaProject();
      if ((javaProject != null) && (javaProject.exists())) {
        try
        {
          return javaProject.findType(toString(expectedValue)) != null;
        }
        catch (JavaModelException localJavaModelException2)
        {
          return false;
        }
      }
    }
    return false;
  }
  
  private String toString(Object expectedValue)
  {
    return expectedValue == null ? "" : expectedValue.toString();
  }
}

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

import org.eclipse.osgi.util.NLS;

public class JavaManipulationMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.core.manipulation.JavaManipulationMessages";
  public static String JavaManipulationMessages_internalError;
  public static String UndoCompilationUnitChange_no_file;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jdt.internal.core.manipulation.JavaManipulationMessages", JavaManipulationMessages.class);
  }
}

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

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

public class JavaManipulationPlugin
  extends Plugin
{
  private static JavaManipulationPlugin fgDefault;
  
  public JavaManipulationPlugin()
  {
    fgDefault = this;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
    fgDefault = null;
  }
  
  public static JavaManipulationPlugin getDefault()
  {
    return fgDefault;
  }
  
  public static String getPluginId()
  {
    return "org.eclipse.jdt.core.manipulation";
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void logErrorMessage(String message)
  {
    log(new Status(4, getPluginId(), 10001, message, null));
  }
  
  public static void logErrorStatus(String message, IStatus status)
  {
    if (status == null)
    {
      logErrorMessage(message);
      return;
    }
    MultiStatus multi = new MultiStatus(getPluginId(), 10001, message, null);
    multi.add(status);
    log(multi);
  }
  
  public static void log(Throwable e)
  {
    log(new Status(4, getPluginId(), 10001, JavaManipulationMessages.JavaManipulationMessages_internalError, e));
  }
}

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

import com.ibm.icu.text.MessageFormat;

public class Messages
{
  public static String format(String message, Object object)
  {
    return MessageFormat.format(message, new Object[] { object });
  }
  
  public static String format(String message, Object[] objects)
  {
    return MessageFormat.format(message, objects);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.core.manipulation.Messages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.core.refactoring.descriptors;

import org.eclipse.osgi.util.NLS;

public class DescriptorMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.core.refactoring.descriptors.DescriptorMessages";
  public static String JavaRefactoringDescriptor_no_description;
  public static String JavaRefactoringDescriptor_no_resulting_descriptor;
  public static String JavaRefactoringDescriptor_not_available;
  public static String MoveDescriptor_no_destination_set;
  public static String MoveDescriptor_no_elements_set;
  public static String MoveStaticMembersDescriptor_invalid_members;
  public static String MoveStaticMembersDescriptor_no_members;
  public static String MoveStaticMembersDescriptor_no_type;
  public static String RenameJavaElementDescriptor_accessor_constraint;
  public static String RenameJavaElementDescriptor_delegate_constraint;
  public static String RenameJavaElementDescriptor_deprecation_constraint;
  public static String RenameJavaElementDescriptor_hierarchical_constraint;
  public static String RenameJavaElementDescriptor_no_java_element;
  public static String RenameJavaElementDescriptor_patterns_constraint;
  public static String RenameJavaElementDescriptor_patterns_qualified_constraint;
  public static String RenameJavaElementDescriptor_project_constraint;
  public static String RenameJavaElementDescriptor_qualified_constraint;
  public static String RenameJavaElementDescriptor_reference_constraint;
  public static String RenameJavaElementDescriptor_similar_constraint;
  public static String RenameJavaElementDescriptor_textual_constraint;
  public static String RenameLocalVariableDescriptor_no_compilation_unit;
  public static String RenameLocalVariableDescriptor_no_selection;
  public static String RenameResourceDescriptor_no_new_name;
  public static String RenameResourceDescriptor_no_resource;
  public static String RenameResourceDescriptor_project_constraint;
  public static String RenameResourceRefactoringContribution_error_cannot_access;
  public static String UseSupertypeDescriptor_no_subtype;
  public static String UseSupertypeDescriptor_no_supertype;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jdt.internal.core.refactoring.descriptors.DescriptorMessages", DescriptorMessages.class);
  }
}

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

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Map;
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.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.WorkingCopyOwner;

public class JavaRefactoringDescriptorUtil
{
  private static final String LOWER_CASE_FALSE = Boolean.FALSE.toString().toLowerCase();
  private static final String LOWER_CASE_TRUE = Boolean.TRUE.toString().toLowerCase();
  
  public static String elementToHandle(String project, IJavaElement element)
  {
    String handle = element.getHandleIdentifier();
    if ((project != null) && (!(element instanceof IJavaProject)))
    {
      IJavaProject javaProject = element.getJavaProject();
      if (project.equals(javaProject.getElementName()))
      {
        String id = javaProject.getHandleIdentifier();
        return handle.substring(id.length());
      }
    }
    return handle;
  }
  
  public static String resourcePathToHandle(String project, IPath resourcePath)
  {
    if ((project != null) && (!"".equals(project)) && (resourcePath.segmentCount() != 1) && 
      (resourcePath.segment(0).equals(project))) {
      return resourcePath.removeFirstSegments(1).toPortableString();
    }
    return resourcePath.toPortableString();
  }
  
  public static IJavaElement handleToElement(WorkingCopyOwner owner, String project, String handle, boolean check)
  {
    IJavaElement element = null;
    if (owner != null) {
      element = JavaCore.create(handle, owner);
    } else {
      element = JavaCore.create(handle);
    }
    if ((element == null) && (project != null))
    {
      IJavaProject javaProject = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProject(project);
      String identifier = javaProject.getHandleIdentifier();
      if (owner != null) {
        element = JavaCore.create(identifier + handle, owner);
      } else {
        element = JavaCore.create(identifier + handle);
      }
    }
    if ((check) && ((element instanceof IMethod)))
    {
      IMethod method = (IMethod)element;
      IMethod[] methods = method.getDeclaringType().findMethods(method);
      if ((methods != null) && (methods.length > 0)) {
        element = methods[0];
      }
    }
    if ((element != null) && ((!check) || (element.exists()))) {
      return element;
    }
    return null;
  }
  
  public static IResource handleToResource(String project, String handle)
  {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    if ("".equals(handle)) {
      return null;
    }
    IPath path = Path.fromPortableString(handle);
    if (path == null) {
      return null;
    }
    if ((project != null) && (!"".equals(project))) {
      return root.getProject(project).findMember(path);
    }
    return root.findMember(path);
  }
  
  public static IPath handleToResourcePath(String project, String handle)
  {
    IPath path = Path.fromPortableString(handle);
    if ((project != null) && (!"".equals(project)) && (!path.isAbsolute())) {
      return new Path(project).append(path).makeAbsolute();
    }
    return path;
  }
  
  public static String getString(Map map, String attribute, boolean allowNull)
    throws IllegalArgumentException
  {
    Object object = map.get(attribute);
    if (object == null)
    {
      if (allowNull) {
        return null;
      }
      throw new IllegalArgumentException("The map does not contain the attribute '" + attribute + "'");
    }
    if ((object instanceof String))
    {
      String value = (String)object;
      return value;
    }
    throw new IllegalArgumentException("The provided map does not contain a string for attribute '" + attribute + "'");
  }
  
  public static String getString(Map map, String attribute)
    throws IllegalArgumentException
  {
    return getString(map, attribute, false);
  }
  
  public static String[] getStringArray(Map map, String countAttribute, String arrayAttribute, int offset)
    throws IllegalArgumentException
  {
    int count = getInt(map, countAttribute);
    String[] result = new String[count];
    for (int i = 0; i < count; i++) {
      result[i] = getString(map, getAttributeName(arrayAttribute, i + offset));
    }
    return result;
  }
  
  public static int getInt(Map map, String attribute)
    throws IllegalArgumentException
  {
    String value = getString(map, attribute);
    try
    {
      return Integer.parseInt(value);
    }
    catch (NumberFormatException localNumberFormatException)
    {
      throw new IllegalArgumentException("The attribute '" + attribute + "' does not contain a valid int '" + value + "'");
    }
  }
  
  public static int getInt(Map map, String attribute, int defaultValue)
    throws IllegalArgumentException
  {
    String value = getString(map, attribute, true);
    if (value == null) {
      return defaultValue;
    }
    try
    {
      return Integer.parseInt(value);
    }
    catch (NumberFormatException localNumberFormatException)
    {
      throw new IllegalArgumentException("The attribute '" + attribute + "' does not contain a valid int '" + value + "'");
    }
  }
  
  public static int[] getIntArray(Map map, String countAttribute, String arrayAttribute)
    throws IllegalArgumentException
  {
    int count = getInt(map, countAttribute);
    int[] result = new int[count];
    for (int i = 0; i < count; i++) {
      result[i] = getInt(map, getAttributeName(arrayAttribute, i));
    }
    return result;
  }
  
  public static String getAttributeName(String attribute, int index)
  {
    return attribute + index;
  }
  
  public static IJavaElement getJavaElement(Map map, String attribute, String project)
    throws IllegalArgumentException
  {
    return getJavaElement(map, attribute, project, false);
  }
  
  public static IJavaElement getJavaElement(Map map, String attribute, String project, boolean allowNull)
    throws IllegalArgumentException
  {
    String handle = getString(map, attribute, allowNull);
    if (handle != null) {
      return handleToElement(null, project, handle, false);
    }
    return null;
  }
  
  public static IJavaElement[] getJavaElementArray(Map map, String countAttribute, String arrayAttribute, int offset, String project, Class arrayClass)
    throws IllegalArgumentException
  {
    if (countAttribute != null)
    {
      int count = getInt(map, countAttribute);
      IJavaElement[] result = (IJavaElement[])Array.newInstance(arrayClass, count);
      for (int i = 0; i < count; i++) {
        result[i] = getJavaElement(map, getAttributeName(arrayAttribute, i + offset), project);
      }
      return result;
    }
    ArrayList result = new ArrayList();
    IJavaElement element = null;
    while ((element = getJavaElement(map, arrayAttribute, project, true)) != null) {
      result.add(element);
    }
    return (IJavaElement[])result.toArray((Object[])Array.newInstance(arrayClass, result.size()));
  }
  
  public static IPath getResourcePath(Map map, String attribute, String project)
    throws IllegalArgumentException
  {
    String handle = getString(map, attribute);
    return handleToResourcePath(project, handle);
  }
  
  public static IPath[] getResourcePathArray(Map map, String countAttribute, String arrayAttribute, int offset, String project)
    throws IllegalArgumentException
  {
    int count = getInt(map, countAttribute);
    IPath[] result = new IPath[count];
    for (int i = 0; i < count; i++) {
      result[i] = getResourcePath(map, getAttributeName(arrayAttribute, i + offset), project);
    }
    return result;
  }
  
  public static boolean[] getBooleanArray(Map map, String countAttribute, String arrayAttribute, int offset)
    throws IllegalArgumentException
  {
    int count = getInt(map, countAttribute);
    boolean[] result = new boolean[count];
    for (int i = 0; i < count; i++) {
      result[i] = getBoolean(map, getAttributeName(arrayAttribute, i + offset));
    }
    return result;
  }
  
  public static boolean getBoolean(Map map, String attribute)
    throws IllegalArgumentException
  {
    String value = getString(map, attribute).toLowerCase();
    if (LOWER_CASE_TRUE.equals(value)) {
      return true;
    }
    if (LOWER_CASE_FALSE.equals(value)) {
      return false;
    }
    throw new IllegalArgumentException("The attribute '" + attribute + "' does not contain a valid boolean: '" + value + "'");
  }
  
  public static boolean hasBoolean(Map map, String attribute)
    throws IllegalArgumentException
  {
    String string = getString(map, attribute, true);
    if (string == null) {
      return false;
    }
    String value = string.toLowerCase();
    if (LOWER_CASE_TRUE.equals(value)) {
      return true;
    }
    if (LOWER_CASE_FALSE.equals(value)) {
      return true;
    }
    throw new IllegalArgumentException("The attribute '" + attribute + "' does not contain a valid boolean: '" + value + "'");
  }
  
  public static boolean getBoolean(Map map, String attribute, boolean defaultValue)
    throws IllegalArgumentException
  {
    String value = getString(map, attribute, true);
    if (value == null) {
      return defaultValue;
    }
    value = value.toLowerCase();
    if (LOWER_CASE_TRUE.equals(value)) {
      return true;
    }
    if (LOWER_CASE_FALSE.equals(value)) {
      return false;
    }
    throw new IllegalArgumentException("The attribute '" + attribute + "' does not contain a valid boolean: '" + value + "'");
  }
  
  public static void setJavaElement(Map arguments, String attribute, String project, 
1 2 3 4

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