The use of curly braces isn't
required when you have just one statement following an
if. In
another topic, I pointed out that the
Java Coding Conventions recommend that you always include the curly braces, and GoToLoop pointed out my own deviation from the conventions. I wanted to continue the discussion, but it was off-topic from the original post.
I realize that there are differing opinions, but in my own code, I usually follow the coding conventions shown in the link.
If you are the only person that needs to read your code you can format it however you choose. But the purpose of coding conventions is to make it easier to work with others in the same codebase. I noticed that Processing's formatter allows all of the following variations:
if (condition)
doSomething();
if (condition) doSomething();
if (condition)
{
doSomething();
}
if (condition) {
doSomething();
}
I prefer the last one, which is the format recommended in the Java conventions. The first one actually surprised me - I would expect the second line to be indented.
What do you think? Should Processing support all of these? Should it enforce a specific coding style? Should it be configurable?
I'm looking at the Editor class, and I see the TextAreaPopup inner class, but I don't see any way to get a reference to it. I was hoping to add menu items from my tool's init() method. Is that possible?