Example usage for org.eclipse.jdt.internal.core CreateImportOperation createBefore

List of usage examples for org.eclipse.jdt.internal.core CreateImportOperation createBefore

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core CreateImportOperation createBefore.

Prototype

public void createBefore(IJavaElement sibling) 

Source Link

Document

Instructs this operation to position the new element before the given sibling, or to add the new element as the last child of its parent if null.

Usage

From source file:org.eclipse.jdt.internal.core.CompilationUnit.java

License:Open Source License

/**
 * @see ICompilationUnit#createImport(String, IJavaElement, int, IProgressMonitor)
 * @since 3.0//from  w ww .ja  va  2 s  .  co  m
 */
public IImportDeclaration createImport(String importName, IJavaElement sibling, int flags,
        IProgressMonitor monitor) throws JavaModelException {
    CreateImportOperation op = new CreateImportOperation(importName, this, flags);
    if (sibling != null) {
        op.createBefore(sibling);
    }
    op.runOperation(monitor);
    return getImport(importName);
}