List of usage examples for org.eclipse.jdt.core IJavaModelStatusConstants INVALID_CLASSPATH
int INVALID_CLASSPATH
To view the source code for org.eclipse.jdt.core IJavaModelStatusConstants INVALID_CLASSPATH.
Click Source Link
From source file:com.codenvy.ide.ext.java.server.internal.core.ClasspathEntry.java
License:Open Source License
private static IJavaModelStatus validateLibraryContents(IPath path, IJavaProject project, String entryPathMsg) { JavaModelManager manager = JavaModelManager.getJavaModelManager(); try {//w w w . j a v a2s. co m manager.verifyArchiveContent(path); } catch (CoreException e) { if (e.getStatus().getMessage() == Messages.status_IOException) { return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_archiveReadError, new String[] { entryPathMsg, project.getElementName() })); } } return JavaModelStatus.VERIFIED_OK; }
From source file:org.eclipse.objectteams.otdt.tests.compiler.smap.AbstractSourceMapGeneratorTest.java
License:Open Source License
public boolean parseAndCompile(org.eclipse.jdt.core.ICompilationUnit[] units, HashMap<String, int[]> methodLineNumbers, String[] classPaths, String outputPath) throws JavaModelException { CompilerOptions options = getCompilerOptions(); SourceElementParser parser = new SourceElementParser(this, new DefaultProblemFactory(Locale.getDefault()), options, false, false);/*from w w w. jav a 2 s. c o m*/ ICompilationUnit[] cUnits = new ICompilationUnit[units.length]; for (int idx = 0; idx < units.length; idx++) { org.eclipse.jdt.core.ICompilationUnit unit = units[idx]; String unit_src = unit.getSource(); IResource unit_res = unit.getCorrespondingResource(); String unit_fileName = unit_res.toString(); char[] unit_source = unit_src.toCharArray(); ICompilationUnit unit_sourceUnit = new CompilationUnit(unit_source, unit_fileName, null); CompilationUnitDeclaration cuDecl = parser.parseCompilationUnit(unit_sourceUnit, true, null); if (cuDecl.hasErrors()) { // approximated error reporting: String expectedErrorlog = "Filename : L/JSR-045/src/" + unit_fileName + "\n" + "COMPILED type(s) " + "to be filled in\n" + "No REUSED BINARY type\n" + "No PROBLEM"; String actualErrorlog = cuDecl.compilationResult().toString(); assertEquals("COMPILATION FAILED. Errorlog should be empty.", expectedErrorlog, actualErrorlog); return false; } cUnits[idx] = unit_sourceUnit; } Requestor requestor = new Requestor(false, null, /*no custom requestor */ false, /* show category */ false /* show warning token*/, methodLineNumbers); if (outputPath != null) { requestor.outputPath = outputPath; File outDir = new File(outputPath); if (!outDir.exists()) outDir.mkdir(); } CustomizedCompiler batchCompiler; try { batchCompiler = new CustomizedCompiler(getNameEnvironment(new String[] {}, classPaths), getErrorHandlingPolicy(), options, requestor, getProblemFactory()); } catch (IOException ioex) { throw new JavaModelException(ioex, IJavaModelStatusConstants.INVALID_CLASSPATH); } batchCompiler.addCallBack(this); batchCompiler.compile(cUnits); // compile all files together boolean hasErrors = requestor.hasErrors; //errorlog contains errore and warnings, skip warnings if (hasErrors) { String expectedErrorlog = ""; String actualErrorlog = requestor.problemLog; assertEquals("COMPILATION FAILED. Errorlog should be empty.", expectedErrorlog, actualErrorlog); } if (methodLineNumbers != null) requestor.checkAllLineNumbersSeen(); return !hasErrors; }