Klasse CreatePackageFragmentOperation

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
org.aspectj.org.eclipse.jdt.internal.core.CreatePackageFragmentOperation
Alle implementierten Schnittstellen:
org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.ICoreRunnable, org.eclipse.core.runtime.IProgressMonitor

public class CreatePackageFragmentOperation extends JavaModelOperation
This operation creates a new package fragment under a given package fragment root. The following must be specified:
  • the package fragment root
  • the package name

Any needed folders/package fragments are created. If the package fragment already exists, this operation has no effect. The result elements include the IPackageFragment created and any side effect package fragments that were created.

NOTE: A default package fragment exists by default for a given root.

Possible exception conditions:

  • Package fragment root is read-only
  • Package fragment's name is taken by a simple (non-folder) resource
  • Felddetails

    • pkgName

      protected String[] pkgName
      The fully qualified, dot-delimited, package name.
  • Konstruktordetails

    • CreatePackageFragmentOperation

      public CreatePackageFragmentOperation(IPackageFragmentRoot parentElement, String packageName, boolean force)
      When executed, this operation will create a package fragment with the given name under the given package fragment root. The dot-separated name is broken into segments. Intermediate folders are created as required for each segment. If the folders already exist, this operation has no effect.
  • Methodendetails

    • executeOperation

      protected void executeOperation() throws JavaModelException
      Execute the operation - creates the new package fragment and any side effect package fragments.
      Angegeben von:
      executeOperation in Klasse JavaModelOperation
      Löst aus:
      JavaModelException - if the operation is unable to complete
    • getSchedulingRule

      protected org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()
      Setzt außer Kraft:
      getSchedulingRule in Klasse JavaModelOperation
    • verify

      public IJavaModelStatus verify()
      Possible failures:
      • NO_ELEMENTS_TO_PROCESS - the root supplied to the operation is null.
      • INVALID_NAME - the name provided to the operation is null or is not a valid package fragment name.
      • READ_ONLY - the root provided to this operation is read only.
      • NAME_COLLISION - there is a pre-existing resource (file) with the same name as a folder in the package fragment's hierarchy.
      • ELEMENT_NOT_PRESENT - the underlying resource for the root is missing
      Setzt außer Kraft:
      verify in Klasse JavaModelOperation
      Siehe auch: