Examples of IImportDeclaration


Examples of org.eclipse.jdt.core.IImportDeclaration

    List existingImport= null;
    if (restoreExistingImports) {
      existingImport= new ArrayList();
      IImportDeclaration[] imports= cu.getImports();
      for (int i= 0; i < imports.length; i++) {
        IImportDeclaration curr= imports[i];
        char prefix= Flags.isStatic(curr.getFlags()) ? STATIC_PREFIX : NORMAL_PREFIX;
        existingImport.add(prefix + curr.getElementName());
      }
    }
    return new ImportRewrite(cu, null, existingImport);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IImportDeclaration

   */
  public boolean hasAssists(IInvocationContext context) throws CoreException {
    IImportDeclaration[] imports = context.getCompilationUnit().getImports();
    // See if we have any JUnit import
    for (int i = 0; i < imports.length; i++) {
      IImportDeclaration id = imports[i];
      String name = id.getElementName();
      if (name.indexOf("junit") != -1) {
        return true;
      }
    }

View Full Code Here

Examples of org.eclipse.jdt.core.IImportDeclaration

*/
public class JdtQuickfixUtils {

  public static TextEdit getTextEditForImport(ICompilationUnit cu, String importTypeNString) {
    try {
      IImportDeclaration requestMappingDecl = cu.getImport(importTypeNString);
      if (requestMappingDecl == null || !requestMappingDecl.exists()) {
        ImportRewrite importRewrite = StubUtility.createImportRewrite(cu, true);
        importRewrite.addImport(importTypeNString);
        return importRewrite.rewriteImports(null);
      }

View Full Code Here

Examples of org.eclipse.jdt.core.IImportDeclaration

    if (!(element instanceof ISourceReference))
      return null;

    if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) {

      IImportDeclaration declaration = (IImportDeclaration) element;
      IImportContainer container = (IImportContainer) declaration
          .getParent();
      ISourceRange srcRange = null;
      try {
        srcRange = container.getSourceRange();
      }
View Full Code Here

Examples of org.eclipse.jdt.core.IImportDeclaration

    if (!(element instanceof ISourceReference))
      return null;

    if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) {

      IImportDeclaration declaration = (IImportDeclaration) element;
      IImportContainer container = (IImportContainer) declaration.getParent();
      ISourceRange srcRange = null;
      try {
        srcRange = container.getSourceRange();
      }
      catch (JavaModelException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.