views:

324

answers:

2

I've managed to get the IDE to compile the java project correctly by modifying the config.ini, but the IDE itself is still showing errors concerning the processor statements:

//#ifdef VER_X
public class Video extends FirstCanvas {
//#else
public class Video extends SecondCanvas {
//#endif
...

Is there a setting or a plug-in that would solve this?

EDIT: Maybe a little clarification: I'm looking for something that will make the IDE editor more compliant with the code. It won't let me follow any definitions because of what the editor THINKS are errors.

A: 

Are you using EclipseME? If yes check this page on how to get it working correctly

Configuring Preprocessor Support

jitter
This just describes how to get preprocessing to work, which I already do. I'm looking for something that will make the IDE editor more compliant with the code. It won't let me follow any definitions because of the errors for example.
Jay
I don't know if that's possible. I guess the mtj.hooks only fix the eclipse java compiler. But after reading a bit through the bug report of the MTJ guys https://bugs.eclipse.org/bugs/show_bug.cgi?id=116143. I got the impression that there shouldn't be any errors in the editor caused by this extension. Could add a screenshot/description of what you are experiencing?
jitter
Sorry I can't since its an internal project and I would have to kill you after answering :P. Basically it's just ignoring the preprocess statements and telling me there's an error with having two class declarations. 'The nested type Video cannot hide an enclosing type'.
Jay
You can't create a small code to reproduce the problem?? You say it ignores the preprocess statements are you sure the mtj.hook is really setup correctly and working
jitter
A: 

A more OO approach to this would use separate classes, selecting between them at runtime:

public class FirstVideo extends FirstCanvas {
   ...
}

public class SecondVideo extends SecondCanvas {
   ...
}

...
video = (something ? new FirstVideo() : new SecondVideo());

This does not require non-standard compilation steps to achieve and doesn't open the door to the eldritch horrors of C/C++ preprocessor directives.

Alan Krueger