Package org.eclipse.jdt.ui.wizards
Class NewTypeWizardPage.ImportsManager
- java.lang.Object
-
- org.eclipse.jdt.ui.wizards.NewTypeWizardPage.ImportsManager
-
- Enclosing class:
- NewTypeWizardPage
public static class NewTypeWizardPage.ImportsManager extends Object
Class used in stub creation routines to add needed imports to a compilation unit.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addImport(String qualifiedTypeName)
Adds a new import declaration that is sorted in the existing imports.String
addImport(String qualifiedTypeName, int insertPosition)
Adds a new import declaration that is sorted in the existing imports.String
addImport(ITypeBinding typeBinding)
Adds a new import declaration that is sorted in the existing imports.String
addImport(ITypeBinding typeBinding, int insertPosition)
Adds a new import declaration that is sorted in the existing imports.String
addStaticImport(String declaringTypeName, String simpleName, boolean isField)
Adds a new import declaration for a static type that is sorted in the existing imports.
-
-
-
Method Detail
-
addImport
public String addImport(String qualifiedTypeName)
Adds a new import declaration that is sorted in the existing imports. If an import already exists or the import would conflict with an import of an other type with the same simple name, the import is not added.- Parameters:
qualifiedTypeName
- The fully qualified name of the type to import (dot separated).- Returns:
- Returns the simple type name that can be used in the code or the fully qualified type name if an import conflict prevented the import.
-
addImport
public String addImport(String qualifiedTypeName, int insertPosition)
Adds a new import declaration that is sorted in the existing imports. If an import already exists or the import would conflict with an import of an other type with the same simple name, the import is not added.- Parameters:
qualifiedTypeName
- The fully qualified name of the type to import (dot separated).insertPosition
- the offset where the import will be used- Returns:
- Returns the simple type name that can be used in the code or the fully qualified type name if an import conflict prevented the import.
- Since:
- 3.8
-
addImport
public String addImport(ITypeBinding typeBinding)
Adds a new import declaration that is sorted in the existing imports. If an import already exists or the import would conflict with an import of an other type with the same simple name, the import is not added.- Parameters:
typeBinding
- the binding of the type to import- Returns:
- Returns the simple type name that can be used in the code or the fully qualified type name if an import conflict prevented the import.
-
addImport
public String addImport(ITypeBinding typeBinding, int insertPosition)
Adds a new import declaration that is sorted in the existing imports. If an import already exists or the import would conflict with an import of an other type with the same simple name, the import is not added.- Parameters:
typeBinding
- the binding of the type to importinsertPosition
- the offset where the import will be used- Returns:
- Returns the simple type name that can be used in the code or the fully qualified type name if an import conflict prevented the import.
- Since:
- 3.8
-
addStaticImport
public String addStaticImport(String declaringTypeName, String simpleName, boolean isField)
Adds a new import declaration for a static type that is sorted in the existing imports. If an import already exists or the import would conflict with an import of an other static import with the same simple name, the import is not added.- Parameters:
declaringTypeName
- The qualified name of the static's member declaring typesimpleName
- the simple name of the member; either a field or a method name.isField
-true
specifies that the member is a field,false
if it is a method.- Returns:
- returns either the simple member name if the import was successful or else the qualified name if an import conflict prevented the import.
- Since:
- 3.2
-
-