eclipse - How to retrieve IProblem instances from current editor? -


i'm writing eclipse plugin, , i'd retrieve instances of iproblem associated open text editor. i've tried following:

iworkbenchwindow window = platformui.getworkbench().getactiveworkbenchwindow(); ieditorpart editor = window.getactivepage().getactiveeditor(); if (!(editor instanceof abstracttexteditor)) {   return null; }  itexteditor texteditor = (itexteditor)editor; idocumentprovider docprov = texteditor.getdocumentprovider(); idocument doc = docprov.getdocument(editor.geteditorinput()); astparser parser = astparser.newparser(ast.jls4); parser.setsource(doc.get().tochararray()); compilationunit cu = (compilationunit) parser.createast(null); return cu.getproblems(); 

however, when run against following code in editor:

import java.io.serializable;   public class testclass implements serializable {      /**      *       */ } 

it doesn't find problems. expect @ least finds missingserialversion problem. perhaps i'm parsing file incorrectly, might cause issue. feel there should way compilationunit editor directly?

update:

if add syntax error source file , invoke plugin, reports syntax problem, not missing serial version uid. suspect kind of configuration issue warnings aren't being reported.

2nd update:

this isn't restricted missingserialversion problem. warning, , not error, not found method. if change problem want see error in compiler settings (or passing in additional options parser making error instead of warning), still no joy getproblems() method respect warnings. (it shows actual errors fine, e.g. if put unrecognized symbol in source code).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -