Lines 10-29
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.internal.core.util; |
11 |
package org.eclipse.jdt.internal.core.util; |
12 |
|
12 |
|
13 |
import java.io.*; |
13 |
import java.io.File; |
|
|
14 |
import java.io.IOException; |
15 |
import java.io.InputStream; |
16 |
import java.io.PrintStream; |
14 |
import java.net.URI; |
17 |
import java.net.URI; |
15 |
import java.util.*; |
18 |
import java.util.Enumeration; |
|
|
19 |
import java.util.HashSet; |
20 |
import java.util.Iterator; |
21 |
import java.util.Map; |
22 |
import java.util.Set; |
23 |
import java.util.StringTokenizer; |
16 |
import java.util.zip.ZipEntry; |
24 |
import java.util.zip.ZipEntry; |
17 |
import java.util.zip.ZipFile; |
25 |
import java.util.zip.ZipFile; |
18 |
|
26 |
|
19 |
import org.eclipse.core.filesystem.EFS; |
27 |
import org.eclipse.core.filesystem.EFS; |
20 |
import org.eclipse.core.filesystem.IFileStore; |
28 |
import org.eclipse.core.filesystem.IFileStore; |
21 |
import org.eclipse.core.resources.*; |
29 |
import org.eclipse.core.resources.IContainer; |
22 |
import org.eclipse.core.runtime.*; |
30 |
import org.eclipse.core.resources.IFile; |
|
|
31 |
import org.eclipse.core.resources.IFolder; |
32 |
import org.eclipse.core.resources.IResource; |
33 |
import org.eclipse.core.resources.IWorkspaceRoot; |
34 |
import org.eclipse.core.resources.ProjectScope; |
35 |
import org.eclipse.core.resources.ResourceAttributes; |
36 |
import org.eclipse.core.resources.ResourcesPlugin; |
37 |
import org.eclipse.core.runtime.Assert; |
38 |
import org.eclipse.core.runtime.CoreException; |
39 |
import org.eclipse.core.runtime.IPath; |
40 |
import org.eclipse.core.runtime.IProgressMonitor; |
41 |
import org.eclipse.core.runtime.IStatus; |
42 |
import org.eclipse.core.runtime.Path; |
43 |
import org.eclipse.core.runtime.Platform; |
44 |
import org.eclipse.core.runtime.QualifiedName; |
45 |
import org.eclipse.core.runtime.Status; |
23 |
import org.eclipse.core.runtime.content.IContentType; |
46 |
import org.eclipse.core.runtime.content.IContentType; |
24 |
import org.eclipse.core.runtime.preferences.IScopeContext; |
47 |
import org.eclipse.core.runtime.preferences.IScopeContext; |
25 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
48 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
26 |
import org.eclipse.jdt.core.*; |
49 |
import org.eclipse.jdt.core.IAnnotation; |
|
|
50 |
import org.eclipse.jdt.core.IClassFile; |
51 |
import org.eclipse.jdt.core.ICompilationUnit; |
52 |
import org.eclipse.jdt.core.IInitializer; |
53 |
import org.eclipse.jdt.core.IJavaElement; |
54 |
import org.eclipse.jdt.core.IJavaModelStatusConstants; |
55 |
import org.eclipse.jdt.core.IJavaProject; |
56 |
import org.eclipse.jdt.core.IMemberValuePair; |
57 |
import org.eclipse.jdt.core.IMethod; |
58 |
import org.eclipse.jdt.core.IPackageFragment; |
59 |
import org.eclipse.jdt.core.ISourceRange; |
60 |
import org.eclipse.jdt.core.IType; |
61 |
import org.eclipse.jdt.core.JavaConventions; |
62 |
import org.eclipse.jdt.core.JavaCore; |
63 |
import org.eclipse.jdt.core.JavaModelException; |
64 |
import org.eclipse.jdt.core.Signature; |
65 |
import org.eclipse.jdt.core.WorkingCopyOwner; |
27 |
import org.eclipse.jdt.core.compiler.CharOperation; |
66 |
import org.eclipse.jdt.core.compiler.CharOperation; |
28 |
import org.eclipse.jdt.core.dom.ASTNode; |
67 |
import org.eclipse.jdt.core.dom.ASTNode; |
29 |
import org.eclipse.jdt.core.dom.ArrayType; |
68 |
import org.eclipse.jdt.core.dom.ArrayType; |
Lines 33-38
Link Here
|
33 |
import org.eclipse.jdt.core.dom.SimpleType; |
72 |
import org.eclipse.jdt.core.dom.SimpleType; |
34 |
import org.eclipse.jdt.core.dom.Type; |
73 |
import org.eclipse.jdt.core.dom.Type; |
35 |
import org.eclipse.jdt.core.dom.WildcardType; |
74 |
import org.eclipse.jdt.core.dom.WildcardType; |
|
|
75 |
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; |
36 |
import org.eclipse.jdt.core.util.IClassFileAttribute; |
76 |
import org.eclipse.jdt.core.util.IClassFileAttribute; |
37 |
import org.eclipse.jdt.core.util.IClassFileReader; |
77 |
import org.eclipse.jdt.core.util.IClassFileReader; |
38 |
import org.eclipse.jdt.core.util.ICodeAttribute; |
78 |
import org.eclipse.jdt.core.util.ICodeAttribute; |
Lines 49-54
Link Here
|
49 |
import org.eclipse.jdt.internal.compiler.env.EnumConstantSignature; |
89 |
import org.eclipse.jdt.internal.compiler.env.EnumConstantSignature; |
50 |
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; |
90 |
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; |
51 |
import org.eclipse.jdt.internal.compiler.env.IDependent; |
91 |
import org.eclipse.jdt.internal.compiler.env.IDependent; |
|
|
92 |
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; |
52 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
93 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
53 |
import org.eclipse.jdt.internal.compiler.lookup.Binding; |
94 |
import org.eclipse.jdt.internal.compiler.lookup.Binding; |
54 |
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; |
95 |
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; |
Lines 925-930
Link Here
|
925 |
} |
966 |
} |
926 |
|
967 |
|
927 |
/** |
968 |
/** |
|
|
969 |
* Initialize the original default java core options. |
970 |
* |
971 |
* @return the original default option map |
972 |
*/ |
973 |
public static Map getOriginalDefaultOptions(Set optionNames) { |
974 |
// Compiler settings |
975 |
Map defaultOptionsMap = new CompilerOptions().getMap(); // compiler defaults |
976 |
|
977 |
// Override some compiler defaults |
978 |
defaultOptionsMap.put(JavaCore.COMPILER_LOCAL_VARIABLE_ATTR, JavaCore.GENERATE); |
979 |
defaultOptionsMap.put(JavaCore.COMPILER_CODEGEN_UNUSED_LOCAL, JavaCore.PRESERVE); |
980 |
defaultOptionsMap.put(JavaCore.COMPILER_TASK_TAGS, JavaCore.DEFAULT_TASK_TAGS); |
981 |
defaultOptionsMap.put(JavaCore.COMPILER_TASK_PRIORITIES, JavaCore.DEFAULT_TASK_PRIORITIES); |
982 |
defaultOptionsMap.put(JavaCore.COMPILER_TASK_CASE_SENSITIVE, JavaCore.ENABLED); |
983 |
defaultOptionsMap.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED); |
984 |
defaultOptionsMap.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR); |
985 |
|
986 |
// Builder settings |
987 |
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ |
988 |
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.ABORT); |
989 |
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE, JavaCore.WARNING); |
990 |
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, JavaCore.CLEAN); |
991 |
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER, JavaCore.IGNORE); |
992 |
|
993 |
// JavaCore settings |
994 |
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_ORDER, JavaCore.IGNORE); |
995 |
defaultOptionsMap.put(JavaCore.CORE_INCOMPLETE_CLASSPATH, JavaCore.ERROR); |
996 |
defaultOptionsMap.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.ERROR); |
997 |
defaultOptionsMap.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.IGNORE); |
998 |
defaultOptionsMap.put(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaCore.ENABLED); |
999 |
defaultOptionsMap.put(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, JavaCore.ENABLED); |
1000 |
|
1001 |
// encoding setting comes from resource plug-in |
1002 |
boolean hasOptionNames = optionNames != null; |
1003 |
if (hasOptionNames) { |
1004 |
optionNames.add(JavaCore.CORE_ENCODING); |
1005 |
} |
1006 |
|
1007 |
// Formatter settings |
1008 |
Map codeFormatterOptionsMap = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); // code formatter defaults |
1009 |
for (Iterator iter = codeFormatterOptionsMap.entrySet().iterator(); iter.hasNext();) { |
1010 |
Map.Entry entry = (Map.Entry) iter.next(); |
1011 |
String optionName = (String) entry.getKey(); |
1012 |
defaultOptionsMap.put(optionName, entry.getValue()); |
1013 |
if (hasOptionNames) { |
1014 |
optionNames.add(optionName); |
1015 |
} |
1016 |
} |
1017 |
|
1018 |
// CodeAssist settings |
1019 |
defaultOptionsMap.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.DISABLED); |
1020 |
defaultOptionsMap.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED); |
1021 |
defaultOptionsMap.put(JavaCore.CODEASSIST_IMPLICIT_QUALIFICATION, JavaCore.DISABLED); |
1022 |
defaultOptionsMap.put(JavaCore.CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ |
1023 |
defaultOptionsMap.put(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ |
1024 |
defaultOptionsMap.put(JavaCore.CODEASSIST_STATIC_FINAL_FIELD_PREFIXES, ""); //$NON-NLS-1$ |
1025 |
defaultOptionsMap.put(JavaCore.CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ |
1026 |
defaultOptionsMap.put(JavaCore.CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ |
1027 |
defaultOptionsMap.put(JavaCore.CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ |
1028 |
defaultOptionsMap.put(JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ |
1029 |
defaultOptionsMap.put(JavaCore.CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES, ""); //$NON-NLS-1$ |
1030 |
defaultOptionsMap.put(JavaCore.CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ |
1031 |
defaultOptionsMap.put(JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ |
1032 |
defaultOptionsMap.put(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaCore.ENABLED); |
1033 |
defaultOptionsMap.put(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaCore.DISABLED); |
1034 |
defaultOptionsMap.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED); |
1035 |
defaultOptionsMap.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); |
1036 |
|
1037 |
// Time out for parameter names |
1038 |
defaultOptionsMap.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$ |
1039 |
return defaultOptionsMap; |
1040 |
} |
1041 |
/** |
928 |
* Returns the line separator found in the given text. |
1042 |
* Returns the line separator found in the given text. |
929 |
* If it is null, or not found return the line delimiter for the given project. |
1043 |
* If it is null, or not found return the line delimiter for the given project. |
930 |
* If the project is null, returns the line separator for the workspace. |
1044 |
* If the project is null, returns the line separator for the workspace. |
Lines 1583-1589
Link Here
|
1583 |
protected static boolean isAttributeSupported(int attribute) { |
1697 |
protected static boolean isAttributeSupported(int attribute) { |
1584 |
return (EFS.getLocalFileSystem().attributes() & attribute) != 0; |
1698 |
return (EFS.getLocalFileSystem().attributes() & attribute) != 0; |
1585 |
} |
1699 |
} |
1586 |
|
|
|
1587 |
/** |
1700 |
/** |
1588 |
* Returns whether the given resource is read-only or not. |
1701 |
* Returns whether the given resource is read-only or not. |
1589 |
* @param resource |
1702 |
* @param resource |