Leonardo Kenji Shikida
Leonardo Kenji Shikida

Reputation: 751

How can I set Eclipse Code Formatter to show one array element per line?

for example, instead of this

private weka.classifiers.Classifier[] wekaClassfiers = new weka.classifiers.Classifier[] { new weka.classifiers.bayes.NaiveBayes(),
        new weka.classifiers.bayes.NaiveBayesMultinomial(), new weka.classifiers.bayes.NaiveBayesMultinomialUpdateable(), new weka.classifiers.bayes.NaiveBayesUpdateable(),
        new weka.classifiers.functions.Logistic(), new weka.classifiers.functions.MultilayerPerceptron(), new weka.classifiers.lazy.LWL(),

format like this

private weka.classifiers.Classifier[] wekaClassfiers = new weka.classifiers.Classifier[] { 
    new weka.classifiers.bayes.NaiveBayes(),
    new weka.classifiers.bayes.NaiveBayesMultinomial(), 
    new weka.classifiers.bayes.NaiveBayesMultinomialUpdateable(), 
    new weka.classifiers.bayes.NaiveBayesUpdateable(),
    new weka.classifiers.functions.Logistic(), 
    new weka.classifiers.functions.MultilayerPerceptron(), 
    new weka.classifiers.lazy.LWL(),

Upvotes: 1

Views: 186

Answers (1)

nitind
nitind

Reputation: 20003

In general, it's good to look at every preference, tool, or option that's available to you.

From the Java->Code Style->Formatter preference page, create a New profile (you're not allowed to modify the ones that are included), and make sure you change the array initializer line wrapping option to be as shown (or another that puts every element on a new line):

Java Code Formatter profile editor dialog

Upvotes: 1

Related Questions