1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
13 //import java.util.StringTokenizer;
15 import net.sourceforge.phpdt.internal.corext.codemanipulation.CodeGenerationSettings;
16 import net.sourceforge.phpdt.internal.corext.util.CodeFormatterUtil;
17 import net.sourceforge.phpdt.ui.PreferenceConstants;
19 import org.eclipse.jface.preference.IPreferenceStore;
21 public class JavaPreferencesSettings {
23 public static CodeGenerationSettings getCodeGenerationSettings() {
24 IPreferenceStore store = PreferenceConstants.getPreferenceStore();
26 CodeGenerationSettings res = new CodeGenerationSettings();
27 res.createComments = store
28 .getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS);
29 res.useKeywordThis = store
30 .getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
31 // res.importOrder= getImportOrderPreference(store);
32 res.importThreshold = getImportNumberThreshold(store);
33 res.tabWidth = CodeFormatterUtil.getTabWidth();
37 public static int getImportNumberThreshold(IPreferenceStore prefs) {
39 .getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
41 threshold = Integer.MAX_VALUE;
46 // public static String[] getImportOrderPreference(IPreferenceStore prefs) {
47 // String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
49 // return unpackList(str, ";"); //$NON-NLS-1$
51 // return new String[0];
54 // private static String[] unpackList(String str, String separator) {
55 // StringTokenizer tok = new StringTokenizer(str, separator); //$NON-NLS-1$
56 // int nTokens = tok.countTokens();
57 // String[] res = new String[nTokens];
58 // for (int i = 0; i < nTokens; i++) {
59 // res[i] = tok.nextToken().trim();