public IIssue next() {
SimpleFeature feature = iter.next();
String extensionPointID=(String) feature.getAttribute(mapper.getExtensionId());
try{
IIssue issue = IssuesListUtil.createIssue(extensionPointID);
if( issue==null ){
return createPlaceHolder(feature, extensionPointID);
}
initIssue(feature,issue);
return issue;
} catch (Throwable e) {
IssuesActivator.log("", e); //$NON-NLS-1$
return createPlaceHolder(feature, extensionPointID);
}
}
public void remove() {
iter.close();
}
protected void initIssue( SimpleFeature feature, IIssue issue ) {
String mementoData=(String) feature.getAttribute(mapper.getMemento());
String viewData=(String) feature.getAttribute(mapper.getViewMemento());
String groupId=(String) feature.getAttribute(mapper.getGroupId());
String id=(String) feature.getAttribute(mapper.getId());
String resolutionInt=(String) feature.getAttribute(mapper.getResolution());
String priorityInt=(String) feature.getAttribute(mapper.getPriority());
String description=(String) feature.getAttribute(mapper.getDescription());
Resolution resolution=Resolution.valueOf(resolutionInt);
if( resolution==null )
resolution=Resolution.UNRESOLVED;
Priority priority=Priority.valueOf(priorityInt);
if( priority==null )
priority=Priority.WARNING;
issue.setDescription(description);
issue.setResolution(resolution);
issue.setPriority(priority);
XMLMemento issueMemento=null;
if (mementoData != null) {
try {
issueMemento = XMLMemento.createReadRoot(new StringReader(mementoData));
} catch (WorkbenchException e) {
issueMemento = null;
}
}
XMLMemento viewMemento=null;
if (viewData != null){
try {
viewMemento = XMLMemento.createReadRoot(new StringReader(viewData));
} catch (WorkbenchException e) {
viewMemento = null;
}
}
ReferencedEnvelope env = new ReferencedEnvelope(feature.getBounds());
issue.init(issueMemento, viewMemento, id, groupId, env);
}
protected IIssue createPlaceHolder( SimpleFeature feature, String extensionId ) {
PlaceholderIssue issue=new PlaceholderIssue();
issue.setExtensionID(extensionId);
initIssue(feature, issue);
return issue;
}
};