Hello everyone.
I seem to be having a problem with associating a problem marker with a resource; in my case, I'm trying to create a problem marker for the editor.
To achieve this, I've tried to do the following:
public class MyEditor extends TextEditor{
private ColorManager colorManager;
public MyEditor() {
super();
...
IResource resource = (IResource) getEditorInput().getAdapter(IResource.class);
try
{
marker = resource.createMarker(IMarker.PROBLEM);
}
catch (CoreException e)
{
e.printStackTrace();
}
}
However, the problem is getEditorInput() keeps returning null. I assume I am not calling it at the right location. I thought it would be ideal to create the marker once I'm setting up the editor, but this proves otherwise.
Does anyone have any advice to obtaining the proper resource I want so that I may create the problem marker? I would like to show errors and such within the editor.
I've looked at samples online for creating the marker, but most just show methods that pass the ITextEditor object without showing where the method call is. (for example: Creating Error Marker for Compiler -- see reportError method)
Thank you. Paul
Edit: I have also viewed the following link regarding problem markers, but again, it calls createMarker from a resource(res, in this case), but does not show the setup for it. See Show Syntax Errors in An Eclipse Editor Plugin