I want to move my code to the Eclipse IDE, how can I split my code there over multiple tabs?

I look more and more into it, and it might not even be possible, this is very much not a toy (not that the processing editor is a toy).

Answers

  • Answer ✓

    In Processing the IDE allows the sketch code to be split over several tabs, each tab being a separate pde file. ALL the code the code from ALL the pde files is merged into a single Java class when the sketch is run.

    In Eclipse the code for a single class must be in a single file (standard Java rules apply)

    So it is not possible to split your code over 'multiple tabs' in Eclipse.

  • But how do they avoid then that the programs become unmanageably big? I mean, For instance its handy if you have a separate tab for all your functions. Put the functions in somehow in a class?

  • Answer ✓

    But how do they avoid then that the programs become unmanageably big?

    1) The Processing language is Java!

    2) Java is an object orientated (OO) language, which means the core construct is the class and Java applications are created from a large numbers of classes.

    3) Processing enables the user to write OO programs without having to know object orientation.

    If you are interested in using Eclipse then you need to get a grounding in Java OO syntax and an understanding of the object orientation paradigm. You might start here.

    So the answer is to create many small-medium size classes designed and written using OO principles.

  • edited May 2014 Answer ✓

    In Processing IDE, all ".pde" files are considered within 1 class which extends PApplet.
    Any further classes we create are nested classes from that top-class!
    In order to have our own top-classes, we gotta create a tab w/ extension ".java" instead! :-$

    Perhaps you should take a peek at this thread below. It got an example of how a sketch looks like as a valid Java code: :P

    http://forum.processing.org/two/discussion/5145/connecting-an-ordinary-java-class-and-processing-class

  • edited May 2014

    Thats a vey interesting approach, and I will try to implement it into my next project. It will save me a lot of hurt. As always you helped you out (Quark did too of course :) )

    One question still thought; if I make a Top-class, must I import all this stuff here by default? or is there more?

    import processing.core.*;
    import processing.data.*;
    import processing.event.*;
    import processing.opengl.*;
    
    import java.util.HashMap;
    import java.util.ArrayList;
    
    import java.io.File;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.IOException;
    
  • edited May 2014

    Those are Processing's "standard" import. Of course you only need those which you actually ends up using after all! :-B
    Most of time, a simple import processing.core.PApplet; is all that a top class needs in order to use Processing's API! ;;)

Sign In or Register to comment.