Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9062033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:38:03+00:00 2026-06-16T15:38:03+00:00

I’m currently developing an eclipse plugin. This plugin contains a project nature which depends

  • 0

I’m currently developing an eclipse plugin. This plugin contains a project nature which depends on the javaScript nature of jsdt.

Now at a few details the JavaScripts that the projects of my nature can contain are somewhat special.

  • They can contain “compiler hints” which are basicly statements beginning with #
  • They can contain return statements outside of functions

But at this two points the standard validation of jsdt come in and marks them as errors (which is normally right). I already managed to get this errors filtered out in the properties of the JavaScript validator (manually).

My question is, how can i exclude these errors from the validation of jsdt automatically for the projects with my nature?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:38:04+00:00Added an answer on June 16, 2026 at 3:38 pm

    After a lot of research, hours of deleting markers and debugging i finally managed to delete the errors i wanted. In a bad bad way of course but i’ve come to a point where i just wanted this to work no matter how it’s done.

    If you ever want to delete existing problems that had been created during the validation process of jsdt you need to do the following (and you must not ommit anything):

    • Create a class extending org.eclipse.wst.jsdt.core.compiler.ValidationParticipant
    • Override isActive(), buildStarting() and reconcile() methods.

    So there are two things you basicly have to care about.

    1. The actual problem markers that will be created or had already been created at the end of the validation process.

    2. The Problems created by the validation process. They are of the type CategorizedProblem and can be obtained by the ReconcileContext object that is passed to the reconcile() method.

    It seems to me that the CategorizedProblems will be translated to problem markers after the validation process.

    So what you need to do is:

    • Delete all unwanted problem markers of all files in buildStarting (this removes problem markers from all files in your project that are about to be validated)
    • Iterate the CategorizedProblem objects of the ReconcileContext (getProblems())
    • Create a new Array containing only the CategorizedProblems you want to keep
    • Set this new Array to the ReconcileContext with putProblems()
    • Delete the unwanted markers again for that file (i don’t know why this is needed, please don’t ask, i don’t care anymore :-/)

    An example implementation of such a validationParticipant could look like this: (this one will filter out problems complaining about return statements outside of methods:

    [...ommited imports ...]
    
    public class MyValidationParticipant extends  org.eclipse.wst.jsdt.core.compiler.ValidationParticipant{
    
    @Override
    public boolean isActive(IJavaScriptProject project) {
        return true;
    }
    
    
    
    @Override
    public void buildStarting(BuildContext[] files, boolean isBatch) {      
        super.buildStarting(files, isBatch);    
        for(BuildContext context : files){
            IFile file = context.getFile();
            deleteUnwantedMarkers(file);
        }
    }
    
    
    @Override
    public void reconcile(ReconcileContext context) {
    
        IResource resource = context.getWorkingCopy().getResource();
        CategorizedProblem[] newProblems = new CategorizedProblem[0];
        ArrayList<CategorizedProblem> newProblemList = new ArrayList<CategorizedProblem>();
    
        CategorizedProblem[] probs = context.getProblems("org.eclipse.wst.jsdt.core.problem");
        if(probs != null){
            for(CategorizedProblem p : probs){
                if(!(p.getMessage().equals("Cannot return from outside a function or method."))){                   
                        newProblemList.add(p);                      
                    }                   
                }
            }
        }           
        context.putProblems("org.eclipse.wst.jsdt.core.problem", newProblemList.toArray(newProblems));      
    
        deleteUnwantedMarkers(resource);
    }
    
    public static void deleteUnwantedMarkers(IResource resource){
        if(resource.isSynchronized(IResource.DEPTH_INFINITE)){
            try {                   
                IMarker[] markers = resource.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
                if(markers != null && markers.length > 0){
                    for(IMarker m : markers){
                        Object message = m.getAttribute(IMarker.MESSAGE);
                        if(message.equals("Cannot return from outside a function or method.")){                         
                            m.delete(); 
                        }                                   
                    }
                }
    
            }catch (CoreException e) {              
                e.printStackTrace();
            }
        }       
    }
    }
    

    As i said, this is kind of a bad solution since the code relies on the String of the error message. There should be better ways to identify the problems you don’t want to have.

    Don’t forget to add a proper extension in your plugin.xml for the ValidationParticipant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.