Analyzer Skeleton for NetBeans IDE

Simple starting point for creating a new analyzer, similar to FindBugs, but this time for something else, e.g., HTML Tidy:

Doesn't do anything yet, but here's the code:

import java.util.Collections;
import javax.swing.JComponent;
import org.netbeans.modules.analysis.spi.Analyzer;
import org.netbeans.spi.editor.hints.ErrorDescription;
import org.openide.util.lookup.ServiceProvider;

public class MyAnalyzer implements Analyzer {

    @Override
    public Iterable<? extends ErrorDescription> analyze() {
        return Collections.emptyList();
    }

    @Override
    public boolean cancel() {
        return true;
    }

    @ServiceProvider(service=AnalyzerFactory.class)
    public static final class MyAnalyzerFactory extends AnalyzerFactory {

        public MyAnalyzerFactory() {
            super("htmltidy", "HTML Tidy", (String) null);
        }
 
        @Override
        public Iterable<? extends WarningDescription> getWarnings() {
            return Collections.emptyList();
        }

        @Override
        public <D, C extends JComponent> CustomizerProvider<D, C> getCustomizerProvider() {
            return null;
        }

        @Override
        public Analyzer createAnalyzer(Context cntxt) {
            return new MyAnalyzer();
        }
 
    }
 
}

The point of the above code, and this entire blog entry, is to highlight the fact that you can integrate your own analyzers, as one or more plugins into NetBeans IDE... because the NetBeans IDE analyzer feature is pluggable.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
23
24
25
26
27
28
29
30
   
       
Today