Klasse CreateImportOperation

Alle implementierten Schnittstellen:
org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.ICoreRunnable, org.eclipse.core.runtime.IProgressMonitor

public class CreateImportOperation extends CreateElementInCUOperation

This operation adds an import declaration to an existing compilation unit. If the compilation unit already includes the specified import declaration, the import is not generated (it does not generate duplicates). Note that it is valid to specify both a single-type import and an on-demand import for the same package, for example "java.io.File" and "java.io.*", in which case both are preserved since the semantics of this are not the same as just importing "java.io.*". Importing "java.lang.*", or the package in which the compilation unit is defined, are not treated as special cases. If they are specified, they are included in the result.

Required Attributes:

  • Compilation unit
  • Import name - the name of the import to add to the compilation unit. For example: "java.io.File" or "java.awt.*"