Report "multiple" inheritence as error
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / preferences / JavaPreferencesSettings.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
12
13 import java.util.StringTokenizer;
14
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;
18
19 import org.eclipse.jface.preference.IPreferenceStore;
20  
21 public class JavaPreferencesSettings  {
22         
23         public static CodeGenerationSettings getCodeGenerationSettings() {
24                 IPreferenceStore store= PreferenceConstants.getPreferenceStore();
25                 
26                 CodeGenerationSettings res= new CodeGenerationSettings();
27                 res.createComments= store.getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS);
28                 res.useKeywordThis= store.getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
29 //              res.importOrder= getImportOrderPreference(store);
30                 res.importThreshold= getImportNumberThreshold(store);
31                 res.tabWidth= CodeFormatterUtil.getTabWidth();
32                 return res;
33         }
34
35         public static int getImportNumberThreshold(IPreferenceStore prefs) {
36                 int threshold= prefs.getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
37                 if (threshold < 0) {
38                         threshold= Integer.MAX_VALUE;
39                 }
40                 return threshold;
41         }
42
43
44 //      public static String[] getImportOrderPreference(IPreferenceStore prefs) {
45 //              String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
46 //              if (str != null) {
47 //                      return unpackList(str, ";"); //$NON-NLS-1$
48 //              }
49 //              return new String[0];
50 //      }
51                 
52         private static String[] unpackList(String str, String separator) {
53                 StringTokenizer tok= new StringTokenizer(str, separator); //$NON-NLS-1$
54                 int nTokens= tok.countTokens();
55                 String[] res= new String[nTokens];
56                 for (int i= 0; i < nTokens; i++) {
57                         res[i]= tok.nextToken().trim();
58                 }
59                 return res;
60         }
61         
62                 
63 }
64