List of usage examples for org.eclipse.jdt.core JavaCore IGNORE
String IGNORE
To view the source code for org.eclipse.jdt.core JavaCore IGNORE.
Click Source Link
From source file:com.codenvy.ide.ext.java.server.internal.core.SearchableEnvironment.java
License:Open Source License
/** * Creates a SearchableEnvironment on the given project *//*from w w w . j a va 2s. c om*/ public SearchableEnvironment(JavaProject project, org.eclipse.jdt.core.ICompilationUnit[] workingCopies) throws JavaModelException { this.project = project; this.checkAccessRestrictions = !JavaCore.IGNORE .equals(project.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true)) || !JavaCore.IGNORE.equals(project.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true)); this.workingCopies = workingCopies; this.nameLookup = project.newNameLookup(workingCopies); }
From source file:com.codenvy.ide.ext.java.server.internal.core.SearchableEnvironmentRequestor.java
License:Open Source License
/** * Constructs a SearchableEnvironmentRequestor that wraps the * given SearchRequestor. The requestor will not accept types in * the <code>unitToSkip</code>. *///from w ww .ja va 2 s .c o m public SearchableEnvironmentRequestor(ISearchRequestor requestor, ICompilationUnit unitToSkip, IJavaProject project, NameLookup nameLookup) { this.requestor = requestor; this.unitToSkip = unitToSkip; this.project = project; this.nameLookup = nameLookup; this.checkAccessRestrictions = !JavaCore.IGNORE .equals(project.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true)) || !JavaCore.IGNORE.equals(project.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true)); }
From source file:com.siteview.mde.internal.core.ClasspathComputer.java
License:Open Source License
/** * Checks if the current value stored in the map is less severe than the given minimum value. If * the minimum value is higher, the map will be updated with the minimum. If the minimum value * is <code>null</code>, the existing value remains. * /*from w w w . j av a2 s . co m*/ * @param map the map to check the value in * @param key the key to get the current value out of the map * @param minimumValue the minimum value allowed or <code>null</code> * @param override whether an existing value in the map should be replaced */ private static void setMinimumCompliance(Map map, String key, String minimumValue, boolean override) { if (minimumValue != null && (override || !map.containsKey(key))) { if (fSeverityTable == null) { fSeverityTable = new HashMap(3); fSeverityTable.put(JavaCore.IGNORE, new Integer(SEVERITY_IGNORE)); fSeverityTable.put(JavaCore.WARNING, new Integer(SEVERITY_WARNING)); fSeverityTable.put(JavaCore.ERROR, new Integer(SEVERITY_ERROR)); } String currentValue = (String) map.get(key); int current = currentValue != null && fSeverityTable.containsKey(currentValue) ? ((Integer) fSeverityTable.get(currentValue)).intValue() : 0; int minimum = minimumValue != null && fSeverityTable.containsKey(minimumValue) ? ((Integer) fSeverityTable.get(minimumValue)).intValue() : 0; if (current < minimum) { map.put(key, minimumValue); } } }
From source file:net.sf.j2s.core.builder.AbstractImageBuilder.java
License:Open Source License
protected Compiler newCompiler() { // disable entire javadoc support if not interested in diagnostics Map projectOptions = this.javaBuilder.javaProject.getOptions(true); String option = (String) projectOptions.get(JavaCore.COMPILER_PB_INVALID_JAVADOC); if (option == null || option.equals(JavaCore.IGNORE)) { // TODO (frederic) see why option is null sometimes while running model tests!? option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS); if (option == null || option.equals(JavaCore.IGNORE)) { option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS); if (option == null || option.equals(JavaCore.IGNORE)) { option = (String) projectOptions.get(JavaCore.COMPILER_PB_UNUSED_IMPORT); if (option == null || option.equals(JavaCore.IGNORE)) { // Unused import need also to look inside javadoc comment projectOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.DISABLED); }//from w w w . j a va2s . c o m } } } // called once when the builder is initialized... can override if needed CompilerOptions compilerOptions = new CompilerOptions(projectOptions); compilerOptions.performMethodsFullRecovery = true; compilerOptions.performStatementsRecovery = true; Compiler newCompiler = new Compiler(this.nameEnvironment, DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, this, ProblemFactory.getProblemFactory(Locale.getDefault())); CompilerOptions options = newCompiler.options; // temporary code to allow the compiler to revert to a single thread String setting = System.getProperty("jdt.compiler.useSingleThread"); //$NON-NLS-1$ newCompiler.useSingleThread = setting != null && setting.equals("true"); //$NON-NLS-1$ // enable the compiler reference info support options.produceReferenceInfo = true; if (options.complianceLevel >= ClassFileConstants.JDK1_6 && options.processAnnotations) { // support for Java 6 annotation processors initializeAnnotationProcessorManager(newCompiler); } return newCompiler; }
From source file:net.sf.j2s.core.builder.Java2ScriptBatchImageBuilder.java
License:Open Source License
protected Compiler newCompiler() { // disable entire javadoc support if not interested in diagnostics Map projectOptions = javaBuilder.javaProject.getOptions(true); String option = (String) projectOptions.get(JavaCore.COMPILER_PB_INVALID_JAVADOC); if (option == null || option.equals(JavaCore.IGNORE)) { // TODO (frederic) see why option is null sometimes while running model tests!? option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS); if (option == null || option.equals(JavaCore.IGNORE)) { option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS); if (option == null || option.equals(JavaCore.IGNORE)) { option = (String) projectOptions.get(JavaCore.COMPILER_PB_UNUSED_IMPORT); if (option == null || option.equals(JavaCore.IGNORE)) { // Unused import need also to look inside javadoc comment projectOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.DISABLED); }// ww w. j av a2 s. c o m } } } // called once when the builder is initialized... can override if needed CompilerOptions compilerOptions = new CompilerOptions(projectOptions); compilerOptions.performMethodsFullRecovery = true; compilerOptions.performStatementsRecovery = true; Compiler newCompiler = new Java2ScriptImageCompiler(nameEnvironment, DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, this, ProblemFactory.getProblemFactory(Locale.getDefault())); CompilerOptions options = newCompiler.options; // temporary code to allow the compiler to revert to a single thread String setting = System.getProperty("jdt.compiler.useSingleThread"); //$NON-NLS-1$ newCompiler.useSingleThread = setting != null && setting.equals("true"); //$NON-NLS-1$ // enable the compiler reference info support options.produceReferenceInfo = true; if (options.complianceLevel >= ClassFileConstants.JDK1_6 && options.processAnnotations) { // support for Java 6 annotation processors initializeAnnotationProcessorManager(newCompiler); } return newCompiler; }
From source file:net.sf.j2s.core.builder.NameEnvironment.java
License:Open Source License
private void computeClasspathLocations(IWorkspaceRoot root, JavaProject javaProject, SimpleLookupTable binaryLocationsPerProject) throws CoreException { /* Update cycle marker */ IMarker cycleMarker = javaProject.getCycleMarker(); if (cycleMarker != null) { int severity = JavaCore.ERROR.equals(javaProject.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true)) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; if (severity != cycleMarker.getAttribute(IMarker.SEVERITY, severity)) cycleMarker.setAttribute(IMarker.SEVERITY, severity); }/*ww w. j a va 2 s. c o m*/ IClasspathEntry[] classpathEntries = javaProject.getExpandedClasspath(); ArrayList sLocations = new ArrayList(classpathEntries.length); ArrayList bLocations = new ArrayList(classpathEntries.length); nextEntry: for (int i = 0, l = classpathEntries.length; i < l; i++) { ClasspathEntry entry = (ClasspathEntry) classpathEntries[i]; IPath path = entry.getPath(); Object target = JavaModel.getTarget(path, true); if (target == null) continue nextEntry; switch (entry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: if (!(target instanceof IContainer)) continue nextEntry; IPath outputPath = entry.getOutputLocation() != null ? entry.getOutputLocation() : javaProject.getOutputLocation(); IContainer outputFolder; if (outputPath.segmentCount() == 1) { outputFolder = javaProject.getProject(); } else { outputFolder = root.getFolder(outputPath); if (!outputFolder.exists()) createOutputFolder(outputFolder); } sLocations.add(ClasspathLocation.forSourceFolder((IContainer) target, outputFolder, entry.fullInclusionPatternChars(), entry.fullExclusionPatternChars(), entry.ignoreOptionalProblems())); continue nextEntry; case IClasspathEntry.CPE_PROJECT: if (!(target instanceof IProject)) continue nextEntry; IProject prereqProject = (IProject) target; if (!JavaProject.hasJavaNature(prereqProject)) continue nextEntry; // if project doesn't have java nature or is not accessible JavaProject prereqJavaProject = (JavaProject) JavaCore.create(prereqProject); IClasspathEntry[] prereqClasspathEntries = prereqJavaProject.getRawClasspath(); ArrayList seen = new ArrayList(); nextPrereqEntry: for (int j = 0, m = prereqClasspathEntries.length; j < m; j++) { IClasspathEntry prereqEntry = prereqClasspathEntries[j]; if (prereqEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { Object prereqTarget = JavaModel.getTarget(prereqEntry.getPath(), true); if (!(prereqTarget instanceof IContainer)) continue nextPrereqEntry; IPath prereqOutputPath = prereqEntry.getOutputLocation() != null ? prereqEntry.getOutputLocation() : prereqJavaProject.getOutputLocation(); IContainer binaryFolder = prereqOutputPath.segmentCount() == 1 ? (IContainer) prereqProject : (IContainer) root.getFolder(prereqOutputPath); if (binaryFolder.exists() && !seen.contains(binaryFolder)) { seen.add(binaryFolder); ClasspathLocation bLocation = ClasspathLocation.forBinaryFolder(binaryFolder, true, entry.getAccessRuleSet()); bLocations.add(bLocation); if (binaryLocationsPerProject != null) { // normal builder mode ClasspathLocation[] existingLocations = (ClasspathLocation[]) binaryLocationsPerProject .get(prereqProject); if (existingLocations == null) { existingLocations = new ClasspathLocation[] { bLocation }; } else { int size = existingLocations.length; System.arraycopy(existingLocations, 0, existingLocations = new ClasspathLocation[size + 1], 0, size); existingLocations[size] = bLocation; } binaryLocationsPerProject.put(prereqProject, existingLocations); } } } } continue nextEntry; case IClasspathEntry.CPE_LIBRARY: if (target instanceof IResource) { IResource resource = (IResource) target; ClasspathLocation bLocation = null; if (resource instanceof IFile) { AccessRuleSet accessRuleSet = (JavaCore.IGNORE .equals(javaProject.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true)) && JavaCore.IGNORE.equals( javaProject.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true))) ? null : entry.getAccessRuleSet(); bLocation = ClasspathLocation.forLibrary((IFile) resource, accessRuleSet); } else if (resource instanceof IContainer) { AccessRuleSet accessRuleSet = (JavaCore.IGNORE .equals(javaProject.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true)) && JavaCore.IGNORE.equals( javaProject.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true))) ? null : entry.getAccessRuleSet(); bLocation = ClasspathLocation.forBinaryFolder((IContainer) target, false, accessRuleSet); // is library folder not output folder } bLocations.add(bLocation); if (binaryLocationsPerProject != null) { // normal builder mode IProject p = resource.getProject(); // can be the project being built ClasspathLocation[] existingLocations = (ClasspathLocation[]) binaryLocationsPerProject .get(p); if (existingLocations == null) { existingLocations = new ClasspathLocation[] { bLocation }; } else { int size = existingLocations.length; System.arraycopy(existingLocations, 0, existingLocations = new ClasspathLocation[size + 1], 0, size); existingLocations[size] = bLocation; } binaryLocationsPerProject.put(p, existingLocations); } } else if (target instanceof File) { AccessRuleSet accessRuleSet = (JavaCore.IGNORE .equals(javaProject.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true)) && JavaCore.IGNORE.equals( javaProject.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true))) ? null : entry.getAccessRuleSet(); bLocations.add(ClasspathLocation.forLibrary(path.toString(), accessRuleSet)); } continue nextEntry; } } // now split the classpath locations... place the output folders ahead of the other .class file folders & jars ArrayList outputFolders = new ArrayList(1); this.sourceLocations = new ClasspathMultiDirectory[sLocations.size()]; if (!sLocations.isEmpty()) { sLocations.toArray(this.sourceLocations); // collect the output folders, skipping duplicates next: for (int i = 0, l = this.sourceLocations.length; i < l; i++) { ClasspathMultiDirectory md = this.sourceLocations[i]; IPath outputPath = md.binaryFolder.getFullPath(); for (int j = 0; j < i; j++) { // compare against previously walked source folders if (outputPath.equals(this.sourceLocations[j].binaryFolder.getFullPath())) { md.hasIndependentOutputFolder = this.sourceLocations[j].hasIndependentOutputFolder; continue next; } } outputFolders.add(md); // also tag each source folder whose output folder is an independent folder & is not also a source folder for (int j = 0, m = this.sourceLocations.length; j < m; j++) if (outputPath.equals(this.sourceLocations[j].sourceFolder.getFullPath())) continue next; md.hasIndependentOutputFolder = true; } } // combine the output folders with the binary folders & jars... place the output folders before other .class file folders & jars this.binaryLocations = new ClasspathLocation[outputFolders.size() + bLocations.size()]; int index = 0; for (int i = 0, l = outputFolders.size(); i < l; i++) this.binaryLocations[index++] = (ClasspathLocation) outputFolders.get(i); for (int i = 0, l = bLocations.size(); i < l; i++) this.binaryLocations[index++] = (ClasspathLocation) bLocations.get(i); }
From source file:org.caesarj.ui.CJDTConfigSettings.java
License:Open Source License
static public boolean isUnusedImportsDisabled() { Hashtable map = JavaCore.getOptions(); return ((String) map.get(JavaCore.COMPILER_PB_UNUSED_IMPORT)).equals(JavaCore.IGNORE) ? true : false; }
From source file:org.caesarj.ui.CJDTConfigSettings.java
License:Open Source License
static public void disableUnusedImports() { Hashtable map = JavaCore.getOptions(); map.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.IGNORE); JavaCore.setOptions(map); }
From source file:org.caesarj.ui.CJDTConfigSettings.java
License:Open Source License
static public void enableUnusedImports() { Hashtable map = JavaCore.getOptions(); map.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.IGNORE); JavaCore.setOptions(map); }
From source file:org.eclipse.ajdt.core.builder.AJBuilder.java
License:Open Source License
/** * This is the workaround discussed in bug 73435 for the case when projects are * checked out from CVS, the AJ projects have no valid build state and projects * depend on them.//from w ww . j a v a 2 s.c o m */ private void updateJavaCompilerPreferences(IProject[] dependingProjects) { boolean setWorkbenchPref = false; for (int i = 0; i < dependingProjects.length; i++) { IProject dependingProject = dependingProjects[i]; try { // Skip over any dependents that are themselves // AspectJ projects if (AspectJPlugin.isAJProject(dependingProject)) { continue; } // Only update dependent projects that have Java natures. // These could be ordinary Java projects or if we running inside // other Eclipse-based tools, they could be J2EE projects like dynamic // web projects. // Note that if the project does not have a Java nature then // the JavaCore.create() call appears to return a null. if (dependingProject.hasNature(JavaCore.NATURE_ID)) { JavaProject jp = (JavaProject) JavaCore.create(dependingProject); // Bug 91131 - In Eclipse 3.1 need to use IEclipsePreferences IEclipsePreferences projectPreferences = jp.getEclipsePreferences(); String[] keys = projectPreferences.keys(); if (keys.length == 0 && !setWorkbenchPref) { Hashtable options = JavaCore.getOptions(); String workbenchSetting = (String) options.get(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH); if (lastWorkbenchPreference.equals(JavaCore.ABORT) && workbenchSetting.equals(JavaCore.IGNORE)) { lastWorkbenchPreference = JavaCore.IGNORE; } else if (lastWorkbenchPreference.equals(JavaCore.ABORT) && workbenchSetting.equals(JavaCore.ABORT)) { if (!setWorkbenchPref) { options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); JavaCore.setOptions(options); setWorkbenchPref = true; lastWorkbenchPreference = JavaCore.IGNORE; } } else if (lastWorkbenchPreference.equals(JavaCore.IGNORE) && workbenchSetting.equals(JavaCore.ABORT)) { if (!setWorkbenchPref) { options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); JavaCore.setOptions(options); setWorkbenchPref = true; } else { lastWorkbenchPreference = JavaCore.ABORT; } } } else if (keys.length > 0 && usingProjectBuildingOptions(keys)) { projectPreferences.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); try { projectPreferences.flush(); } catch (BackingStoreException e) { // problem with pref store - quietly ignore } lastWorkbenchPreference = (String) JavaCore.getOptions() .get(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH); } } // end if dependent has a Java nature } catch (CoreException e) { } catch (BackingStoreException e) { } } }