Package org.aspectj.org.eclipse.jdt.core

Examples of org.aspectj.org.eclipse.jdt.core.JavaModelException


    // actual file saving
    try {
      setSharedProperty(JavaProject.CLASSPATH_FILENAME, encodeClasspath(newClasspath, newOutputLocation, true, unknownElements));
      return true;
    } catch (CoreException e) {
      throw new JavaModelException(e);
    }
  }
View Full Code Here


  super(parentElement, source, force);
}
protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
  ASTNode node = super.generateElementAST(rewriter, document, cu);
  if (node.getNodeType() != ASTNode.FIELD_DECLARATION)
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
  return node;
}
View Full Code Here

}
/**
* Handles an install exception by throwing a Java Model exception.
*/
protected void handleInstallException(InstallException e) throws JavaModelException {
  throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.EVALUATION_ERROR, e.toString()));
}
View Full Code Here

  super(parentElement, source, false);
}
protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
  ASTNode node = super.generateElementAST(rewriter, document, cu);
  if (node.getNodeType() != ASTNode.INITIALIZER)
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
  return node;
}
View Full Code Here

   * @param group
   * @return the edit or null if no sorting is required
   */
  public TextEdit calculateEdit(org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit unit, TextEditGroup group) throws JavaModelException {
    if (this.elementsToProcess.length != 1)
      throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.NO_ELEMENTS_TO_PROCESS));
   
    if (!(this.elementsToProcess[0] instanceof ICompilationUnit))
      throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this.elementsToProcess[0]));
   
    try {
      beginTask(Messages.operation_sortelements, getMainAmountOfWork());
     
      ICompilationUnit cu= (ICompilationUnit)this.elementsToProcess[0];
View Full Code Here

    // delete remaining files in this package (.class file in the case where Proj=src=bin)
    IResource[] remainingFiles;
    try {
      remainingFiles = ((IContainer) res).members();
    } catch (CoreException ce) {
      throw new JavaModelException(ce);
    }
    boolean isEmpty = true;
    for (int i = 0, length = remainingFiles.length; i < length; i++) {
      IResource file = remainingFiles[i];
      if (file instanceof IFile && org.aspectj.org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(file.getName())) {
View Full Code Here

      break;
    case IJavaElement.PACKAGE_FRAGMENT :
      deletePackageFragment((IPackageFragment) element);
      break;
    default :
      throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, element));
  }
  // ensure the element is closed
  if (element instanceof IOpenable) {
    ((IOpenable)element).close();
  }
View Full Code Here

            delta.changed(resultElements[i], IJavaElementDelta.F_CONTENT);
          }
          addDelta(delta);
        }
      } else {
        throw new JavaModelException(new JavaModelStatus(
          IJavaModelStatusConstants.NAME_COLLISION,
          Messages.bind(Messages.status_nameCollision, compilationUnitFile.getFullPath().toString())));
      }
    } else {
      try {
        String encoding = null;
        try {
          encoding = folder.getDefaultCharset(); // get folder encoding as file is not accessible
        }
        catch (CoreException ce) {
          // use no encoding
        }
        InputStream stream = new ByteArrayInputStream(encoding == null ? fSource.getBytes() : fSource.getBytes(encoding));
        createFile(folder, unit.getElementName(), stream, force);
        resultElements = new IJavaElement[] {unit};
        if (!Util.isExcluded(unit)
            && unit.getParent().exists()) {
          for (int i = 0; i < resultElements.length; i++) {
            delta.added(resultElements[i]);
          }
          addDelta(delta);
        }
      } catch (IOException e) {
        throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
      }
    }
    worked(1);
  } finally {
    done();
View Full Code Here

  super((PackageFragment) classFile.getParent(), ((BinaryType) ((ClassFile) classFile).getType()).getSourceFileName(null/*no info available*/), owner);
  this.classFile = classFile;
}

public void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException {
  throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this));
}
View Full Code Here

        System.out.println("(" + Thread.currentThread() + ") [JarEntryFile.getContents()] Creating ZipFile on " +zipFile.getName()); //$NON-NLS-1$  //$NON-NLS-2$
      }
      String entryName = getEntryName();
      ZipEntry zipEntry = zipFile.getEntry(entryName);
      if (zipEntry == null){
        throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, entryName));
      }
      byte[] contents = Util.getZipEntryByteContent(zipEntry, zipFile);
      return new ByteArrayInputStream(contents);
    } catch (IOException e){
      throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
    } finally {
      // avoid leaking ZipFiles
      JavaModelManager.getJavaModelManager().closeZipFile(zipFile);
    }
  }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.JavaModelException

Copyright © 2018 www.massapicom. 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.