Bug 119452

Summary: CategorizedProblem's category should be available from markers
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 119444    
Bug Blocks:    

Description Markus Keller CLA 2005-12-06 12:39:54 EST
I20051130-1215

CategorizedProblem's category should be available from markers. Currently, I don't see a way for clients to get the category from an IMarker, since the category is not stored in an attribute. The following section from CategorizedProblem's javadoc has been copied from IProblem - I think it should be updated to tell what's the deal with categories (rather than IDs):

 * Note: the compiler produces IProblems internally, which are turned into
 * markers by the JavaBuilder so as to persist problem descriptions. This
 * explains why there is no API allowing to reach IProblem detected when
 * compiling. However, the Java problem markers carry equivalent information to
 * IProblem, in particular their ID (attribute "id") is set to one of the IDs
 * defined on this interface.

It's not yet 100% clear how the categorization API in the Problems view will look like (see bug 119444). If we decide that loading the jdt.ui plug-in for displaying jdt problems is acceptable, then we could also live with an API to get the category name or ID from a problemID.
Comment 1 Philipe Mulet CLA 2005-12-06 15:21:29 EST
I did not add the #category API from marker, until we know what is needed to meet requirements. Note that the category can always be determined from the ID, so I would favor a static method on 
CategorizedProblem#computeCategoryID(int problemID)

Would this do the trick ? If a static alternative is preferred, then it would result in an extra slot into the problem marker itself, which is likely fine anyhow. 

Which way do you prefer ?
Comment 2 Markus Keller CLA 2005-12-06 15:38:42 EST
Hm, could you add CategorizedProblem#computeCategoryID(int problemID) for now with the risk of having to add the category attribute later? This would allow us to play with the current problems view implementation.

The final decision will have to wait for bug 119444.
Comment 3 Philipe Mulet CLA 2006-02-28 12:50:42 EST
Java problem markers now have an attribute "categoryId" so as to persist the category they belong to.

Marking as FIXED (it was actually released into v_635).
Comment 4 Philipe Mulet CLA 2006-02-28 12:51:52 EST
Verified