|
|
Re: IMarker - problem view and editor [message #331972 is a reply to message #331945] |
Tue, 30 September 2008 19:36 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
John Rodriguez![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=johnrod%40yahoo.com) Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Thanks for your help.
Can getting the resource be done with static calls to get the resource (I
don't have the IRresource when I am trying to make a marker because I have
only a file name path that is given back from the Lua interpreter).
For example using:
ResourcesPlugin.getWorkspace() ...
In my line break point code, I am given a IWorkBechPart, from which I can
get my text editor:
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection
selection) throws CoreException {
ITextEditor textEditor = getEditor(part);
IResource resource = (IResource)
editorPart.getEditorInput().getAdapter(IResource.class);
But I believe you are referring to the file resource that I have
interpreted to find the Lua syntax error in the editor, correct?
Daniel Megert wrote:
> John Rodriguez wrote:
>> I have written a new implementation of a debugger and editor for Lua.
>>
>> I was trying to set an "Error" IMarker in the editor.
>>
>> I set an IMarker and the marker shows up in the "Problems view" but
>> not in the editor. How can I get it to appear in both?
>> Here is the code I set the marker with.
>>
>> IWorkspaceRunnable editorMarker = new IWorkspaceRunnable() {
>> public void run(IProgressMonitor monitor) throws CoreException {
>> IMarker marker = ResourcesPlugin.getWorkspace().getRoot().
> This is wrong. You need to create the marker on the resource that's
> shown in the editor.
> Dani
>> createMarker(IMarker.PROBLEM);
>> marker.setAttribute(IMarker.MESSAGE, msg);
>> marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
>> marker.setAttribute(IMarker.TRANSIENT, true);
>> marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
>> }
>> };
>> try {
>> ResourcesPlugin.getWorkspace().run(editorMarker, null);
>> } catch (CoreException e) {
>> System.err.println("Some error set marker: " + e);
>> }
>>
|
|
|
Re: IMarker - problem view and editor [message #331992 is a reply to message #331972] |
Wed, 01 October 2008 10:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Dani Megert![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=Daniel_Megert%40ch.ibm.com) Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
John Rodriguez wrote:
> Thanks for your help.
>
> Can getting the resource be done with static calls to get the resource
> (I don't have the IRresource when I am trying to make a marker because
> I have only a file name path that is given back from the Lua
> interpreter).
>
> For example using:
> ResourcesPlugin.getWorkspace() ...
>
> In my line break point code, I am given a IWorkBechPart, from which I
> can get my text editor:
>
> public void toggleLineBreakpoints(IWorkbenchPart part, ISelection
> selection) throws CoreException {
> ITextEditor textEditor = getEditor(part);
> IResource resource = (IResource)
> editorPart.getEditorInput().getAdapter(IResource.class);
>
> But I believe you are referring to the file resource that I have
> interpreted to find the Lua syntax error in the editor, correct?
Right. At the point you add the marker you need to resolve the correct
resource otherwise it won't show up in the editor.
Dani
>
>
> Daniel Megert wrote:
>
>> John Rodriguez wrote:
>>> I have written a new implementation of a debugger and editor for Lua.
>>>
>>> I was trying to set an "Error" IMarker in the editor.
>>>
>>> I set an IMarker and the marker shows up in the "Problems view" but
>>> not in the editor. How can I get it to appear in both?
>>> Here is the code I set the marker with.
>>>
>>> IWorkspaceRunnable editorMarker = new IWorkspaceRunnable() {
>>> public void run(IProgressMonitor monitor) throws CoreException {
>>> IMarker marker =
>>> ResourcesPlugin.getWorkspace().getRoot().
>> This is wrong. You need to create the marker on the resource that's
>> shown in the editor.
>
>> Dani
>>> createMarker(IMarker.PROBLEM);
>>> marker.setAttribute(IMarker.MESSAGE, msg);
>>> marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
>>> marker.setAttribute(IMarker.TRANSIENT, true);
>>> marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
>>> }
>>> };
>>> try {
>>> ResourcesPlugin.getWorkspace().run(editorMarker, null);
>>> } catch (CoreException e) {
>>> System.err.println("Some error set marker: " + e);
>>> }
>>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05633 seconds