List of usage examples for org.eclipse.jdt.core.compiler CategorizedProblem CAT_TYPE
int CAT_TYPE
To view the source code for org.eclipse.jdt.core.compiler CategorizedProblem CAT_TYPE.
Click Source Link
From source file:astview.ProblemNode.java
License:Open Source License
private String getCategoryCode() { CategorizedProblem categorized = (CategorizedProblem) fProblem; int categoryID = categorized.getCategoryID(); StringBuffer buf = new StringBuffer(); switch (categoryID) { case CategorizedProblem.CAT_UNSPECIFIED: buf.append("Unspecified"); break;/*from ww w.j a v a 2s .c o m*/ case CategorizedProblem.CAT_BUILDPATH: buf.append("Buildpath"); break; case CategorizedProblem.CAT_SYNTAX: buf.append("Syntax"); break; case CategorizedProblem.CAT_IMPORT: buf.append("Import"); break; case CategorizedProblem.CAT_TYPE: buf.append("Type"); break; case CategorizedProblem.CAT_MEMBER: buf.append("Member"); break; case CategorizedProblem.CAT_INTERNAL: buf.append("Internal"); break; case CategorizedProblem.CAT_JAVADOC: buf.append("Javadoc"); break; case CategorizedProblem.CAT_CODE_STYLE: buf.append("Code Style"); break; case CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM: buf.append("Potential Programming Problem"); break; case CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT: buf.append("Name Shadowing Conflict"); break; case CategorizedProblem.CAT_DEPRECATION: buf.append("Deprecation"); break; case CategorizedProblem.CAT_UNNECESSARY_CODE: buf.append("Unnecessary Code"); break; case CategorizedProblem.CAT_UNCHECKED_RAW: buf.append("Unchecked Raw"); break; case CategorizedProblem.CAT_NLS: buf.append("NLS"); break; case CategorizedProblem.CAT_RESTRICTION: buf.append("Restriction"); break; default: buf.append("<UNKNOWN CATEGORY>"); break; } buf.append(" = ").append(categoryID); return buf.toString(); }
From source file:fromastview.ProblemNode.java
License:Open Source License
private String getCategoryCode() { CategorizedProblem categorized = (CategorizedProblem) fProblem; int categoryID = categorized.getCategoryID(); StringBuffer buf = new StringBuffer(); switch (categoryID) { case CategorizedProblem.CAT_UNSPECIFIED: buf.append("Unspecified"); break;//from w w w . j a va 2 s . c o m case CategorizedProblem.CAT_BUILDPATH: buf.append("Buildpath"); break; case CategorizedProblem.CAT_SYNTAX: buf.append("Syntax"); break; case CategorizedProblem.CAT_IMPORT: buf.append("Import"); break; case CategorizedProblem.CAT_TYPE: buf.append("Type"); break; case CategorizedProblem.CAT_MEMBER: buf.append("Member"); break; case CategorizedProblem.CAT_INTERNAL: buf.append("Internal"); break; case CategorizedProblem.CAT_JAVADOC: buf.append("Javadoc"); break; case CategorizedProblem.CAT_CODE_STYLE: buf.append("Code Style"); break; case CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM: buf.append("Potential Programming Problem"); break; case CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT: buf.append("Name Shadowing Conflict"); break; case CategorizedProblem.CAT_DEPRECATION: buf.append("Deprecation"); break; case CategorizedProblem.CAT_UNNECESSARY_CODE: buf.append("Unnecessary Code"); break; case CategorizedProblem.CAT_UNCHECKED_RAW: buf.append("Unchecked Raw"); break; case CategorizedProblem.CAT_NLS: buf.append("NLS"); break; case CategorizedProblem.CAT_RESTRICTION: buf.append("Restriction"); break; default: buf.append("<UNKNOWN CATEGORY>"); break; } buf.append(" = ").append(categoryID); return buf.toString(); }
From source file:org.eclipse.objectteams.otdt.test.builder.IncrementalTests.java
License:Open Source License
public void testRemoveTeamType() throws JavaModelException { System.out.println("***** testRemoveTeamType() *****"); IPath projectPath = env.addProject("Project", "1.5"); env.addExternalJars(projectPath, Util.getJavaClassLibs()); env.addExternalJar(projectPath, getOTREPath(this.weavingScheme)); // remove old package fragment root so that names don't collide env.removePackageFragmentRoot(projectPath, ""); IPath root = env.addPackageFragmentRoot(projectPath, "src"); env.setOutputFolder(projectPath, "bin"); env.addClass(root, "p", "AA", "package p; \n" + "public team class AA { }"); IPath pathToAB = env.addClass(root, "p.AA", "R", "team package p.AA; \n" + " protected class R {}"); fullBuild(projectPath);//from w w w . j av a2s . c o m expectingNoProblems(); /* Remove team AA */ env.removeClass(env.getPackagePath(root, "p"), "AA"); /* build must detect, that R - although unchanged - becomes invalid. */ incrementalBuild(projectPath); expectingProblemsFor(pathToAB); expectingSpecificProblemFor(pathToAB, new Problem("", "Enclosing team p.AA not found for role file R (OTJLD 1.2.5(c)).", pathToAB, 13, 17, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); /* Restore team AA */ env.addClass(root, "p", "AA", "package p; \n" + "public team class AA {}"); incrementalBuild(projectPath); expectingNoProblems(); }
From source file:org.eclipse.objectteams.otdt.test.builder.IncrementalTests.java
License:Open Source License
public void testRemoveRoleType() throws JavaModelException { System.out.println("***** testRemoveRoleType() *****"); IPath projectPath = env.addProject("Project", "1.5"); env.addExternalJars(projectPath, Util.getJavaClassLibs()); env.addExternalJar(projectPath, getOTREPath(this.weavingScheme)); // remove old package fragment root so that names don't collide env.removePackageFragmentRoot(projectPath, ""); IPath root = env.addPackageFragmentRoot(projectPath, "src"); env.setOutputFolder(projectPath, "bin"); env.addClass(root, "p", "AA", "package p; \n" + "public team class AA { \n" + " protected class RA {}}"); IPath pathToAB = env.addClass(root, "p", "AB", "package p; \n" + "public team class AB extends AA {" + " protected class RB extends RA {} }"); fullBuild(projectPath);//from w ww . j a va 2s . c o m expectingNoProblems(); /* Remove role AA.RA */ env.addClass(root, "p", "AA", "package p; \n" + "public team class AA {}"); /* build must detect, that AB - although unchanged - becomes invalid. */ incrementalBuild(projectPath); expectingProblemsFor(pathToAB); expectingSpecificProblemFor(pathToAB, new Problem("", "RA cannot be resolved to a type", pathToAB, 75, 77, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); /* Restore role AA.RA */ env.addClass(root, "p", "AA", "package p; \n" + "public team class AA { \n" + " public class RA {}}"); incrementalBuild(projectPath); expectingNoProblems(); }
From source file:org.eclipse.objectteams.otdt.test.builder.IncrementalTests.java
License:Open Source License
public void testRemoveRoleFile() throws JavaModelException { System.out.println("***** testRemoveRoleFile() *****"); IPath projectPath = env.addProject("Project", "1.5"); env.addExternalJars(projectPath, Util.getJavaClassLibs()); env.addExternalJar(projectPath, getOTREPath(this.weavingScheme)); // remove old package fragment root so that names don't collide env.removePackageFragmentRoot(projectPath, ""); IPath root = env.addPackageFragmentRoot(projectPath, "src"); env.setOutputFolder(projectPath, "bin"); env.addClass(root, "p", "Outer", "package p; \n" + "public team class Outer {}"); IPath pathToNested = env.addClass(root, "p/Outer", "Nested", "team package p.Outer;\n" + "protected team class Nested {}"); IPath pathToOuterSub = env.addClass(root, "p", "OuterSub", "package p; \n" + "public team class OuterSub extends Outer {\n" + " Nested aRole;\n" + "}"); fullBuild(projectPath);/*from w w w .ja v a2 s . com*/ expectingNoProblems(); /* Remove role Outer.Nested */ env.removeFile(pathToNested); /* build must detect, that AB - although unchanged - becomes invalid -- but no further errors/exceptions */ incrementalBuild(projectPath); expectingProblemsFor(pathToOuterSub); expectingSpecificProblemFor(pathToOuterSub, new Problem("", "Nested cannot be resolved to a type", pathToOuterSub, 58, 64, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testWrongBaseImport2() throws CoreException, IOException { IJavaProject trac18b = fileManager.setUpJavaProject("Trac18b"); env.addProject(trac18b.getProject()); IJavaProject aspectPlugin = fileManager.setUpJavaProject("WrongBaseImport2"); aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aspectPlugin.getProject()); fullBuild();/*from w w w. j a v a2 s .c o m*/ expectingNoProblemsFor(trac18b.getPath()); expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] { new Problem("", "Illegal base import: this package is not provided by the declared base plug-in org.eclipse.objectteams.otequinox but by plug-in Trac18b (OT/Equinox).", aspectPlugin.getPath().append(new Path("src/WrongBaseImportTeam2.java")), 12, 34, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR) }); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
private Problem getIllegalUseOfForcedExportProblem(IJavaProject project, String className, int start, int end) { return new Problem("", "The forced-exported type " + className + " cannot be accessed other than as a role's base class (OT/Equinox).", project.getPath().append(new Path("src/IllegalUseOfForcedExportTeam.java")), start, end, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR); }
From source file:org.jboss.tools.arquillian.core.internal.builder.ArquillianBuilder.java
License:Open Source License
private IMarker storeProblem(ICompilationUnit unit, String message, Integer severity, String type) throws CoreException { if (severity == null || unit == null || unit.getUnderlyingResource() == null) { return null; }//from w w w .j av a 2 s . c om IMarker marker = unit.getUnderlyingResource().createMarker(type); String[] attributeNames = ArquillianConstants.ARQUILLIAN_PROBLEM_MARKER_ATTRIBUTE_NAMES; String[] allNames = attributeNames; Object[] allValues = new Object[allNames.length]; // standard attributes int index = 0; StringBuffer sb = new StringBuffer(); sb.append("Arquillian: "); //$NON-NLS-1$ sb.append(message); allValues[index++] = sb.toString(); // message allValues[index++] = severity; ISourceRange range = null; IMember javaElement = unit.findPrimaryType(); if (javaElement != null) { try { range = javaElement.getNameRange(); } catch (JavaModelException e) { if (e.getJavaModelStatus().getCode() != IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST) { throw e; } if (!CharOperation.equals(javaElement.getElementName().toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) { throw e; } } } int start = range == null ? 0 : range.getOffset(); int end = range == null ? 1 : start + range.getLength(); allValues[index++] = new Integer(ArquillianConstants.ARQUILLIAN_PROBLEM_ID); // ID allValues[index++] = new Integer(start); // start allValues[index++] = new Integer(end > 0 ? end + 1 : end); // end allValues[index++] = new Integer(CategorizedProblem.CAT_TYPE); // category // ID allValues[index++] = ArquillianConstants.SOURCE_ID; if (javaElement != null) { allValues[index++] = ((IType) javaElement).getFullyQualifiedName(); } marker.setAttributes(allNames, allValues); return marker; }
From source file:org.jboss.tools.arquillian.core.internal.compiler.ArquillianCompilationParticipant.java
License:Open Source License
private void storeProblem(SourceFile sourceFile, String message, Integer severity) throws CoreException { if (severity == null) { return;/*from ww w . jav a 2 s . c om*/ } IMarker marker = sourceFile.resource.createMarker(ArquillianConstants.MARKER_CLASS_ID); String[] attributeNames = ArquillianConstants.ARQUILLIAN_PROBLEM_MARKER_ATTRIBUTE_NAMES; String[] allNames = attributeNames; Object[] allValues = new Object[allNames.length]; // standard attributes int index = 0; StringBuffer sb = new StringBuffer(); sb.append("Arquillian: "); sb.append(message); allValues[index++] = sb.toString(); // message allValues[index++] = severity; ISourceRange range = null; IMember javaElement = ArquillianSearchEngine.getType(sourceFile); if (javaElement != null) { try { range = javaElement.getNameRange(); } catch (JavaModelException e) { if (e.getJavaModelStatus().getCode() != IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST) { throw e; } if (!CharOperation.equals(javaElement.getElementName().toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) { throw e; } } } int start = range == null ? 0 : range.getOffset(); int end = range == null ? 1 : start + range.getLength(); allValues[index++] = new Integer(ArquillianConstants.ARQUILLIAN_PROBLEM_ID); // ID allValues[index++] = new Integer(start); // start allValues[index++] = new Integer(end > 0 ? end + 1 : end); // end allValues[index++] = new Integer(CategorizedProblem.CAT_TYPE); // category // ID allValues[index++] = ArquillianConstants.SOURCE_ID; if (javaElement != null) { allValues[index++] = ((IType) javaElement).getFullyQualifiedName(); } marker.setAttributes(allNames, allValues); }