From: khartlage Date: Mon, 22 Mar 2004 21:11:35 +0000 (+0000) Subject: misc changes in the internal builder X-Git-Url: http://git.phpeclipse.com?hp=fcadbe263fb8b5b695872a15fc5b3cd95c652a2c misc changes in the internal builder --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java index 22cce48..e31c253 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java @@ -10,7 +10,6 @@ *******************************************************************************/ package net.sourceforge.phpdt.core; -import net.sourceforge.phpeclipse.PHPCore; /** * Markers used by the Java model. @@ -26,7 +25,7 @@ public interface IJavaModelMarker { * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during compilation. */ - public static final String JAVA_MODEL_PROBLEM_MARKER = PHPCore.PLUGIN_ID + ".problem"; //$NON-NLS-1$ + public static final String JAVA_MODEL_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".problem"; //$NON-NLS-1$ /** @@ -35,7 +34,7 @@ public interface IJavaModelMarker { * problems detected by the Java tooling (such as a problem * detected by the outliner, or a problem detected during a code completion) */ - public static final String TRANSIENT_PROBLEM = PHPCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$ + public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$ /** * Java model task marker type (value "org.eclipse.jdt.core.task"). @@ -45,7 +44,7 @@ public interface IJavaModelMarker { * option "org.eclipse.jdt.core.compiler.taskTag". * @since 2.1 */ - public static final String TASK_MARKER = PHPCore.PLUGIN_ID + ".task"; //$NON-NLS-1$ + public static final String TASK_MARKER = JavaCore.PLUGIN_ID + ".task"; //$NON-NLS-1$ /** @@ -81,7 +80,7 @@ public interface IJavaModelMarker { * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during classpath setting. */ - public static final String BUILDPATH_PROBLEM_MARKER = PHPCore.PLUGIN_ID + ".buildpath_problem"; //$NON-NLS-1$ + public static final String BUILDPATH_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".buildpath_problem"; //$NON-NLS-1$ /** * Classpath file format marker attribute (value "classpathFileFormat"). diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java index 6e8531b..440e421 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java @@ -1,55 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * IBM Corporation - added the following constants: - * COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE - * COMPILER_PB_STATIC_ACCESS_RECEIVER - * COMPILER_TASK_TAGS - * CORE_CIRCULAR_CLASSPATH - * CORE_INCOMPLETE_CLASSPATH - * IBM Corporation - added run(IWorkspaceRunnable, IProgressMonitor) - * IBM Corporation - added exclusion patterns to source classpath entries - * IBM Corporation - added specific output location to source classpath entries - * IBM Corporation - added the following constants: - * CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER - * CLEAN - * IBM Corporation - added getClasspathContainerInitializer(String) - * IBM Corporation - added the following constants: - * CODEASSIST_ARGUMENT_PREFIXES - * CODEASSIST_ARGUMENT_SUFFIXES - * CODEASSIST_FIELD_PREFIXES - * CODEASSIST_FIELD_SUFFIXES - * CODEASSIST_LOCAL_PREFIXES - * CODEASSIST_LOCAL_SUFFIXES - * CODEASSIST_STATIC_FIELD_PREFIXES - * CODEASSIST_STATIC_FIELD_SUFFIXES - * COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION - *******************************************************************************/ package net.sourceforge.phpdt.core; +import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; +import java.util.List; import java.util.Map; import net.sourceforge.phpdt.internal.core.BatchOperation; import net.sourceforge.phpdt.internal.core.BufferManager; +import net.sourceforge.phpdt.internal.core.ClasspathEntry; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.core.Region; +import net.sourceforge.phpdt.internal.corext.Assert; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IWorkspace; @@ -58,3181 +32,3739 @@ import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IPluginDescriptor; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Preferences; +public class JavaCore { + +// public static HashSet OptionNames = new HashSet(20); + /** + * The plug-in identifier of the Java core support + * (value "org.phpeclipse.phpdt.core"). + */ +// public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core"; //$NON-NLS-1$ + public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID; + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$ + + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String INSERT = "insert"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$ + + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String NORMAL = "normal"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPACT = "compact"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String TAB = "tab"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String SPACE = "space"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String ENABLED = "enabled"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String DISABLED = "disabled"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CLEAN = "clean"; //$NON-NLS-1$ + + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ + + /** + * Name of the handle id attribute in a Java marker. + */ + protected static final String ATT_HANDLE_ID = + "net.sourceforge.phpdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$ + + // *************** Possible IDs for configurable options. ******************** + + /** + * Possible configurable option ID. + * @see #getDefaultOptions() + */ + public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions() + */ + public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ + /** + * Possible configurable option value for COMPILER_TASK_PRIORITIES. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$ + /** + * Possible configurable option value for COMPILER_TASK_PRIORITIES. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ + /** + * Possible configurable option value for COMPILER_TASK_PRIORITIES. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$ + /** + * Default task tag + * @since 2.1 + */ + public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ + /** + * Default task priority + * @since 2.1 + */ + public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$ + /** + * Possible configurable option ID + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$ + + // *************** Possible values for configurable options. ******************** + + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String GENERATE = "generate"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String PRESERVE = "preserve"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String ABORT = "abort"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String ERROR = "error"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String WARNING = "warning"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String IGNORE = "ignore"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String COMPUTE = "compute"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + + + /** + * Returns a table of all known configurable options with their default values. + * These options allow to configure the behaviour of the underlying components. + * The client may safely use the result as a template that they can modify and + * then pass to setOptions. + * + * Helper constants have been defined on JavaCore for each of the option ID and + * their possible constant values. + * + * Note: more options might be added in further releases. + *
+   * RECOGNIZED OPTIONS:
+   * COMPILER / Generating Local Variable Debug Attribute
+   *    When generated, this attribute will enable local variable names 
+   *    to be displayed in debugger, only in place where variables are 
+   *    definitely assigned (.class file is then bigger)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
+   *     - possible values:   { "generate", "do not generate" }
+   *     - default:           "generate"
+   *
+   * COMPILER / Generating Line Number Debug Attribute 
+   *    When generated, this attribute will enable source code highlighting in debugger 
+   *    (.class file is then bigger).
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
+   *     - possible values:   { "generate", "do not generate" }
+   *     - default:           "generate"
+   *    
+   * COMPILER / Generating Source Debug Attribute 
+   *    When generated, this attribute will enable the debugger to present the 
+   *    corresponding source code.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
+   *     - possible values:   { "generate", "do not generate" }
+   *     - default:           "generate"
+   *    
+   * COMPILER / Preserving Unused Local Variables
+   *    Unless requested to preserve unused local variables (i.e. never read), the 
+   *    compiler will optimize them out, potentially altering debugging
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
+   *     - possible values:   { "preserve", "optimize out" }
+   *     - default:           "preserve"
+   * 
+   * COMPILER / Defining Target Java Platform
+   *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+   *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
+   *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
+   *     - default:           "1.1"
+   *
+   * COMPILER / Reporting Unreachable Code
+   *    Unreachable code can optionally be reported as an error, warning or simply 
+   *    ignored. The bytecode generation will always optimized it out.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "error"
+   *
+   * COMPILER / Reporting Invalid Import
+   *    An import statement that cannot be resolved might optionally be reported 
+   *    as an error, as a warning or ignored.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "error"
+   *
+   * COMPILER / Reporting Attempt to Override Package-Default Method
+   *    A package default method is not visible in a different package, and thus 
+   *    cannot be overridden. When enabling this option, the compiler will signal 
+   *    such scenarii either as an error or a warning.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Method With Constructor Name
+   *    Naming a method with a constructor name is generally considered poor 
+   *    style programming. When enabling this option, the compiler will signal such 
+   *    scenarii either as an error or a warning.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Deprecation
+   *    When enabled, the compiler will signal use of deprecated API either as an 
+   *    error or a warning.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Deprecation Inside Deprecated Code
+   *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
+   *    The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
+   *     - possible values:   { "enabled", "disabled" }
+   *     - default:           "disabled"
+   *
+   * COMPILER / Reporting Hidden Catch Block
+   *    Locally to a try statement, some catch blocks may hide others , e.g.
+   *      try {  throw new java.io.CharConversionException();
+   *      } catch (java.io.CharConversionException e) {
+   *      } catch (java.io.IOException e) {}. 
+   *    When enabling this option, the compiler will issue an error or a warning for hidden 
+   *    catch blocks corresponding to checked exceptions
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Unused Local
+   *    When enabled, the compiler will issue an error or a warning for unused local 
+   *    variables (i.e. variables never read from)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   *
+   * COMPILER / Reporting Unused Parameter
+   *    When enabled, the compiler will issue an error or a warning for unused method 
+   *    parameters (i.e. parameters never read from)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   *
+   * COMPILER / Reporting Unused Import
+   *    When enabled, the compiler will issue an error or a warning for unused import 
+   *    reference 
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Synthetic Access Emulation
+   *    When enabled, the compiler will issue an error or a warning whenever it emulates 
+   *    access to a non-accessible member of an enclosing type. Such access can have
+   *    performance implications.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   *
+   * COMPILER / Reporting Non-Externalized String Literal
+   *    When enabled, the compiler will issue an error or a warning for non externalized 
+   *    String literal (i.e. non tagged with //$NON-NLS-$). 
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   * 
+   * COMPILER / Reporting Usage of 'assert' Identifier
+   *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
+   *    used as an identifier (reserved keyword in 1.4)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   * 
+   * COMPILER / Reporting Usage of expression receiver on static invocation/field access
+   *    When enabled, the compiler will issue an error or a warning whenever a static field
+   *    or method is accessed with an expression receiver.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   * 
+   * COMPILER / Reporting Assignment with no effect
+   *    When enabled, the compiler will issue an error or a warning whenever an assignment
+   *    has no effect (e.g 'x = x').
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   * 
+   * COMPILER / Setting Source Compatibility Mode
+   *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
+   *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+   *   level should be set to "1.4" and the compliance mode should be "1.4".
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.source"
+   *     - possible values:   { "1.3", "1.4" }
+   *     - default:           "1.3"
+   * 
+   * COMPILER / Setting Compliance Level
+   *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
+   *    should not go beyond "1.3" level.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.compliance"
+   *     - possible values:   { "1.3", "1.4" }
+   *     - default:           "1.3"
+   * 
+   * COMPILER / Maximum number of problems reported per compilation unit
+   *    Specify the maximum number of problems reported on each compilation unit.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
+   *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
+   *     - default:           "100"
+   * 
+   * COMPILER / Define the Automatic Task Tags
+   *    When the tag is non empty, the compiler will issue a task marker whenever it encounters
+   *    one of the corresponding tag inside any comment in Java source code.
+   *    Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskTags"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * COMPILER / Define the Automatic Task Priorities
+   *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
+   *    of the task markers issued by the compiler.
+   *    If the default is specified, the priority of each task marker is "NORMAL".
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskPriorities"
+   *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
+   *     - default:           ""
+   * 
+   * BUILDER / Specifying Filters for Resource Copying Control
+   *    Allow to specify some filters to control the resource copy process.
+   *     - option id:         "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
+   *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
+   *       or the name of a folder which ends with '/'
+   *     - default:           ""
+   * 
+   * BUILDER / Abort if Invalid Classpath
+   *    Allow to toggle the builder to abort if the classpath is invalid
+   *     - option id:         "org.phpeclipse.phpdt.core.builder.invalidClasspath"
+   *     - possible values:   { "abort", "ignore" }
+   *     - default:           "ignore"
+   * 
+   * BUILDER / Cleaning Output Folder(s)
+   *    Indicate whether the JavaBuilder is allowed to clean the output folders
+   *    when performing full build operations.
+   *     - option id:         "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
+   *     - possible values:   { "clean", "ignore" }
+   *     - default:           "clean"
+   * 
+   * JAVACORE / Computing Project Build Order
+   *    Indicate whether JavaCore should enforce the project build order to be based on
+   *    the classpath prerequisite chain. When requesting to compute, this takes over
+   *    the platform default order (based on project references).
+   *     - option id:         "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
+   *     - possible values:   { "compute", "ignore" }
+   *     - default:           "ignore"	 
+   * 
+   * JAVACORE / Specify Default Source Encoding Format
+   *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
+   *    to 'ResourcesPlugin.getEncoding()'.
+   *     - option id:         "org.phpeclipse.phpdt.core.encoding"
+   *     - possible values:   { any of the supported encoding name}.
+   *     - default:           
+   * 
+   * JAVACORE / Reporting Incomplete Classpath
+   *    An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
+   *     - option id:         "org.phpeclipse.phpdt.core.incompleteClasspath"
+   *     - possible values:   { "error", "warning"}
+   *     - default:           "error"
+   * 
+   * JAVACORE / Reporting Classpath Cycle
+   *    A project is involved in a cycle.
+   *     - option id:         "org.phpeclipse.phpdt.core.circularClasspath"
+   *     - possible values:   { "error", "warning" }
+   *     - default:           "error"
+   * 
+   *	FORMATTER / Inserting New Line Before Opening Brace
+   *    When Insert, a new line is inserted before an opening brace, otherwise nothing
+   *    is inserted
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "do not insert"
+   * 
+   *	FORMATTER / Inserting New Line Inside Control Statement
+   *    When Insert, a new line is inserted between } and following else, catch, finally
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "do not insert"
+   * 
+   *	FORMATTER / Clearing Blank Lines
+   *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
+   *    and all others removed.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
+   *     - possible values:   { "clear all", "preserve one" }
+   *     - default:           "preserve one"
+   * 
+   *	FORMATTER / Inserting New Line Between Else/If 
+   *    When Insert, a blank line is inserted between an else and an if when they are 
+   *    contiguous. When choosing to not insert, else-if will be kept on the same
+   *    line when possible.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "do not insert"
+   * 
+   *	FORMATTER / Inserting New Line In Empty Block
+   *    When insert, a line break is inserted between contiguous { and }, if } is not followed
+   *    by a keyword.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "insert"
+   * 
+   *	FORMATTER / Splitting Lines Exceeding Length
+   *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
+   *    disable line splitting
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.lineSplit"
+   *     - possible values:	"", where n is zero or a positive integer
+   *     - default:           "80"
+   * 
+   *	FORMATTER / Compacting Assignment
+   *    Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
+   *    is inserted before the assignment operator
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.style.assignment"
+   *     - possible values:   { "compact", "normal" }
+   *     - default:           "normal"
+   * 
+   *	FORMATTER / Defining Indentation Character
+   *    Either choose to indent with tab characters or spaces
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.char"
+   *     - possible values:   { "tab", "space" }
+   *     - default:           "tab"
+   * 
+   *	FORMATTER / Defining Space Indentation Length
+   *    When using spaces, set the amount of space characters to use for each 
+   *    indentation mark.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.size"
+   *     - possible values:	"", where n is a positive integer
+   *     - default:           "4"
+   * 
+   *	CODEASSIST / Activate Visibility Sensitive Completion
+   *    When active, completion doesn't show that you can not see
+   *    (e.g. you can not see private methods of a super class).
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
+   *     - possible values:   { "enabled", "disabled" }
+   *     - default:           "disabled"
+   * 
+   *	CODEASSIST / Automatic Qualification of Implicit Members
+   *    When active, completion automatically qualifies completion on implicit
+   *    field references and message expressions.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
+   *     - possible values:   { "enabled", "disabled" }
+   *     - default:           "disabled"
+   * 
+   *  CODEASSIST / Define the Prefixes for Field Name
+   *    When the prefixes is non empty, completion for field name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Prefixes for Static Field Name
+   *    When the prefixes is non empty, completion for static field name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Prefixes for Local Variable Name
+   *    When the prefixes is non empty, completion for local variable name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Prefixes for Argument Name
+   *    When the prefixes is non empty, completion for argument name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Field Name
+   *    When the suffixes is non empty, completion for field name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Static Field Name
+   *    When the suffixes is non empty, completion for static field name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Local Variable Name
+   *    When the suffixes is non empty, completion for local variable name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Argument Name
+   *    When the suffixes is non empty, completion for argument name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+ * + * @return a mutable table containing the default settings of all known options + * (key type: String; value type: String) + * @see #setOptions + */ +// public static Hashtable getDefaultOptions() { +// +// Hashtable defaultOptions = new Hashtable(10); +// +// // see #initializeDefaultPluginPreferences() for changing default settings +// Preferences preferences = getPlugin().getPluginPreferences(); +// HashSet optionNames = OptionNames; +// +// // get preferences set to their default +// String[] defaultPropertyNames = preferences.defaultPropertyNames(); +// for (int i = 0; i < defaultPropertyNames.length; i++) { +// String propertyName = defaultPropertyNames[i]; +// if (optionNames.contains(propertyName)) { +// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); +// } +// } +// // get preferences not set to their default +// String[] propertyNames = preferences.propertyNames(); +// for (int i = 0; i < propertyNames.length; i++) { +// String propertyName = propertyNames[i]; +// if (optionNames.contains(propertyName)) { +// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); +// } +// } +// // get encoding through resource plugin +// defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); +// +// return defaultOptions; +// } + /** + * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) + * Note that it may answer null if this option does not exist. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param optionName the name of an option + * @return the String value of a given option + * @see JavaCore#getDefaultOptions + * @since 2.0 + */ +// public static String getOption(String optionName) { +// +// if (CORE_ENCODING.equals(optionName)) { +// return ResourcesPlugin.getEncoding(); +// } +// if (OptionNames.contains(optionName)) { +// Preferences preferences = getPlugin().getPluginPreferences(); +// return preferences.getString(optionName).trim(); +// } +// return null; +// } + + /** + * Returns the table of the current options. Initially, all options have their default values, + * and this method returns a table that includes all known options. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @return table of current settings of all options + * (key type: String; value type: String) + * @see JavaCore#getDefaultOptions + */ +// public static Hashtable getOptions() { +// +// Hashtable options = new Hashtable(10); +// +// // see #initializeDefaultPluginPreferences() for changing default settings +// Plugin plugin = getPlugin(); +// if (plugin != null) { +// Preferences preferences = getPlugin().getPluginPreferences(); +// HashSet optionNames = OptionNames; +// +// // get preferences set to their default +// String[] defaultPropertyNames = preferences.defaultPropertyNames(); +// for (int i = 0; i < defaultPropertyNames.length; i++) { +// String propertyName = defaultPropertyNames[i]; +// if (optionNames.contains(propertyName)) { +// options.put(propertyName, preferences.getDefaultString(propertyName)); +// } +// } +// // get preferences not set to their default +// String[] propertyNames = preferences.propertyNames(); +// for (int i = 0; i < propertyNames.length; i++) { +// String propertyName = propertyNames[i]; +// if (optionNames.contains(propertyName)) { +// options.put(propertyName, preferences.getString(propertyName).trim()); +// } +// } +// // get encoding through resource plugin +// options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); +// } +// return options; +// } + /** + * Sets the current table of options. All and only the options explicitly included in the given table + * are remembered; all previous option settings are forgotten, including ones not explicitly + * mentioned. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param newOptions the new options (key type: String; value type: String), + * or null to reset all options to their default values + * @see JavaCore#getDefaultOptions + */ +// public static void setOptions(Hashtable newOptions) { +// +// // see #initializeDefaultPluginPreferences() for changing default settings +// Preferences preferences = getPlugin().getPluginPreferences(); +// +// if (newOptions == null) { +// newOptions = getDefaultOptions(); +// } +// Enumeration keys = newOptions.keys(); +// while (keys.hasMoreElements()) { +// String key = (String) keys.nextElement(); +// if (!OptionNames.contains(key)) +// continue; // unrecognized option +// if (key.equals(CORE_ENCODING)) +// continue; // skipped, contributed by resource prefs +// String value = (String) newOptions.get(key); +// preferences.setValue(key, value); +// } +// +// // persist options +// getPlugin().savePluginPreferences(); +// } + public static IProject[] getPHPProjects() { + List phpProjectsList = new ArrayList(); + IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace().getRoot().getProjects(); + + for (int i = 0; i < workspaceProjects.length; i++) { + IProject iProject = workspaceProjects[i]; + if (isPHPProject(iProject)) + phpProjectsList.add(iProject); + } + + IProject[] phpProjects = new IProject[phpProjectsList.size()]; + return (IProject[]) phpProjectsList.toArray(phpProjects); + } + +// public static PHPProject getPHPProject(String name) { +// IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(name); +// if (isPHPProject(aProject)) { +// PHPProject thePHPProject = new PHPProject(); +// thePHPProject.setProject(aProject); +// return thePHPProject; +// } +// return null; +// } + + public static boolean isPHPProject(IProject aProject) { + try { + return aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID); + } catch (CoreException e) { + } + + return false; + } + +// public static PHPFile create(IFile aFile) { +// if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// +// return null; +// } + +// public static PHPProject create(IProject aProject) { +// +// try { +// if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { +// PHPProject project = new PHPProject(); +// project.setProject(aProject); +// return project; +// } +// } catch (CoreException e) { +// System.err.println("Exception occurred in PHPCore#create(IProject): " + e.toString()); +// } +// +// return null; +// } + + public static void addPHPNature(IProject project, IProgressMonitor monitor) throws CoreException { + if (!project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { + IProjectDescription description = project.getDescription(); + String[] prevNatures = description.getNatureIds(); + String[] newNatures = new String[prevNatures.length + 1]; + System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); + newNatures[prevNatures.length] = PHPeclipsePlugin.PHP_NATURE_ID; + description.setNatureIds(newNatures); + project.setDescription(description, monitor); + } + } + + /** + * Returns the single instance of the PHP core plug-in runtime class. + * + * @return the single instance of the PHP core plug-in runtime class + */ + public static Plugin getPlugin() { + return PHPeclipsePlugin.getDefault(); + } + + /** + * Initializes the default preferences settings for this plug-in. + */ + + /** + * Runs the given action as an atomic Java model operation. + *

+ * After running a method that modifies Java elements, + * registered listeners receive after-the-fact notification of + * what just transpired, in the form of a element changed event. + * This method allows clients to call a number of + * methods that modify java elements and only have element + * changed event notifications reported at the end of the entire + * batch. + *

+ *

+ * If this method is called outside the dynamic scope of another such + * call, this method runs the action and then reports a single + * element changed event describing the net effect of all changes + * done to java elements by the action. + *

+ *

+ * If this method is called in the dynamic scope of another such + * call, this method simply runs the action. + *

+ * + * @param action the action to perform + * @param monitor a progress monitor, or null if progress + * reporting and cancellation are not desired + * @exception CoreException if the operation failed. + * @since 2.1 + */ + public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + if (workspace.isTreeLocked()) { + new BatchOperation(action).run(monitor); + } else { + // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode + workspace.run(new BatchOperation(action), monitor); + } + } + +/** + * Adds the given listener for changes to Java elements. + * Has no effect if an identical listener is already registered. + * + * This listener will only be notified during the POST_CHANGE resource change notification + * and any reconcile operation (POST_RECONCILE). + * For finer control of the notification, use addElementChangedListener(IElementChangedListener,int), + * which allows to specify a different eventMask. + * + * @see ElementChangedEvent + * @param listener the listener + */ +public static void addElementChangedListener(IElementChangedListener listener) { + addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); +} /** - * The plug-in runtime class for the Java model plug-in containing the core - * (UI-free) support for Java projects. + * Adds the given listener for changes to Java elements. + * Has no effect if an identical listener is already registered. + * After completion of this method, the given listener will be registered for exactly + * the specified events. If they were previously registered for other events, they + * will be deregistered. *

- * Like all plug-in runtime classes (subclasses of Plugin), this - * class is automatically instantiated by the platform when the plug-in gets - * activated. Clients must not attempt to instantiate plug-in runtime classes - * directly. + * Once registered, a listener starts receiving notification of changes to + * java elements in the model. The listener continues to receive + * notifications until it is replaced or removed. *

*

- * The single instance of this class can be accessed from any plug-in declaring - * the Java model plug-in as a prerequisite via - * JavaCore.getJavaCore(). The Java model plug-in will be activated - * automatically if not already active. + * Listeners can listen for several types of event as defined in ElementChangeEvent. + * Clients are free to register for any number of event types however if they register + * for more than one, it is their responsibility to ensure they correctly handle the + * case where the same java element change shows up in multiple notifications. + * Clients are guaranteed to receive only the events for which they are registered. *

+ * + * @param listener the listener + * @param eventMask the bit-wise OR of all event types of interest to the listener + * @see IElementChangedListener + * @see ElementChangedEvent + * @see #removeElementChangedListener(IElementChangedListener) + * @since 2.0 */ -public final class JavaCore extends Plugin implements IExecutableExtension { - - private static Plugin JAVA_CORE_PLUGIN = null; - /** - * The plug-in identifier of the Java core support - * (value "org.eclipse.jdt.core"). - */ - public static final String PLUGIN_ID = "org.eclipse.jdt.core" ; //$NON-NLS-1$ - - /** - * The identifier for the Java builder - * (value "org.eclipse.jdt.core.javabuilder"). - */ - public static final String BUILDER_ID = PLUGIN_ID + ".javabuilder" ; //$NON-NLS-1$ - - /** - * The identifier for the Java model - * (value "org.eclipse.jdt.core.javamodel"). - */ - public static final String MODEL_ID = PLUGIN_ID + ".javamodel" ; //$NON-NLS-1$ - - /** - * The identifier for the Java nature - * (value "org.eclipse.jdt.core.javanature"). - * The presence of this nature on a project indicates that it is - * Java-capable. - * - * @see org.eclipse.core.resources.IProject#hasNature(java.lang.String) - */ - public static final String NATURE_ID = PLUGIN_ID + ".javanature" ; //$NON-NLS-1$ - - /** - * Name of the handle id attribute in a Java marker. - */ - protected static final String ATT_HANDLE_ID = - "org.eclipse.jdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$ - - // *************** Possible IDs for configurable options. ******************** - - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$ - /** - * Default task tag - * @since 2.1 - */ - public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ - /** - * Default task priority - * @since 2.1 - */ - public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ - /** - * Possible configurable option ID - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$ - - // *************** Possible values for configurable options. ******************** - - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String GENERATE = "generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String PRESERVE = "preserve"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ABORT = "abort"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String ERROR = "error"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String WARNING = "warning"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String IGNORE = "ignore"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String COMPUTE = "compute"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String INSERT = "insert"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String NORMAL = "normal"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPACT = "compact"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String TAB = "tab"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String SPACE = "space"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ENABLED = "enabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DISABLED = "disabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CLEAN = "clean"; //$NON-NLS-1$ - - /** - * Creates the Java core plug-in. - * @since 2.1 - */ - public JavaCore(IPluginDescriptor pluginDescriptor) { - super(pluginDescriptor); - JAVA_CORE_PLUGIN = this; - } +public static void addElementChangedListener(IElementChangedListener listener, int eventMask) { + JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask); +} - /** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * - * This listener will only be notified during the POST_CHANGE resource change notification - * and any reconcile operation (POST_RECONCILE). - * For finer control of the notification, use addElementChangedListener(IElementChangedListener,int), - * which allows to specify a different eventMask. - * - * @see ElementChangedEvent - * @param listener the listener - */ - public static void addElementChangedListener(IElementChangedListener listener) { - addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); - } - - /** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * After completion of this method, the given listener will be registered for exactly - * the specified events. If they were previously registered for other events, they - * will be deregistered. - *

- * Once registered, a listener starts receiving notification of changes to - * java elements in the model. The listener continues to receive - * notifications until it is replaced or removed. - *

- *

- * Listeners can listen for several types of event as defined in ElementChangeEvent. - * Clients are free to register for any number of event types however if they register - * for more than one, it is their responsibility to ensure they correctly handle the - * case where the same java element change shows up in multiple notifications. - * Clients are guaranteed to receive only the events for which they are registered. - *

- * - * @param listener the listener - * @param eventMask the bit-wise OR of all event types of interest to the listener - * @see IElementChangedListener - * @see ElementChangedEvent - * @see #removeElementChangedListener(IElementChangedListener) - * @since 2.0 - */ - public static void addElementChangedListener(IElementChangedListener listener, int eventMask) { - JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask); - } - - /** - * Configures the given marker attribute map for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param attributes the mutable marker attribute map (key type: String, - * value type: String) - * @param element the Java element for which the marker needs to be configured - */ - public static void addJavaElementMarkerAttributes( - Map attributes, - IJavaElement element) { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (attributes != null && element != null) - attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); - } +/** + * Configures the given marker attribute map for the given Java element. + * Used for markers, which denote a Java element rather than a resource. + * + * @param attributes the mutable marker attribute map (key type: String, + * value type: String) + * @param element the Java element for which the marker needs to be configured + */ +public static void addJavaElementMarkerAttributes( + Map attributes, + IJavaElement element) { +// if (element instanceof IMember) +// element = ((IMember) element).getClassFile(); + if (attributes != null && element != null) + attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); +} - /** - * Configures the given marker for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param marker the marker to be configured - * @param element the Java element for which the marker needs to be configured - * @exception CoreException if the IMarker.setAttribute on the marker fails - */ - public void configureJavaElementMarker(IMarker marker, IJavaElement element) - throws CoreException { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (marker != null && element != null) - marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); - } +/** + * Configures the given marker for the given Java element. + * Used for markers, which denote a Java element rather than a resource. + * + * @param marker the marker to be configured + * @param element the Java element for which the marker needs to be configured + * @exception CoreException if the IMarker.setAttribute on the marker fails + */ +public void configureJavaElementMarker(IMarker marker, IJavaElement element) + throws CoreException { +// if (element instanceof IMember) +// element = ((IMember) element).getClassFile(); + if (marker != null && element != null) + marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); +} - /** - * Returns the Java model element corresponding to the given handle identifier - * generated by IJavaElement.getHandleIdentifier(), or - * null if unable to create the associated element. - */ - public static IJavaElement create(String handleIdentifier) { - if (handleIdentifier == null) { - return null; - } - try { - return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier); - } catch (JavaModelException e) { - return null; - } - } - /** - * Returns the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element. - * - *

The file must be one of:

- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given file - * @return the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element - */ - public static IJavaElement create(IFile file) { - return JavaModelManager.create(file, null); - } - /** - * Returns the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element. - *

- * Note that a package fragment root is returned rather than a default package. - *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given folder - * @return the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element - */ - public static IJavaElement create(IFolder folder) { - return JavaModelManager.create(folder, null); - } - /** - * Returns the Java project corresponding to the given project. - *

- * Creating a Java Project has the side effect of creating and opening all of the - * project's parents if they are not yet open. - *

- * Note that no check is done at this time on the existence or the java nature of this project. - * - * @param project the given project - * @return the Java project corresponding to the given project, null if the given project is null - */ - public static IJavaProject create(IProject project) { - if (project == null) { - return null; - } - JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel(); - return javaModel.getJavaProject(project); +/** + * Returns the Java model element corresponding to the given handle identifier + * generated by IJavaElement.getHandleIdentifier(), or + * null if unable to create the associated element. + */ +public static IJavaElement create(String handleIdentifier) { + if (handleIdentifier == null) { + return null; } - /** - * Returns the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element. - *

- * The resource must be one of:

- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param resource the given resource - * @return the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element - */ - public static IJavaElement create(IResource resource) { - return JavaModelManager.create(resource, null); + try { + return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier); + } catch (JavaModelException e) { + return null; } - /** - * Returns the Java model. - * - * @param root the given root - * @return the Java model, or null if the root is null - */ - public static IJavaModel create(IWorkspaceRoot root) { - if (root == null) { - return null; - } - return JavaModelManager.getJavaModelManager().getJavaModel(); +} +/** + * Returns the Java element corresponding to the given file, or + * null if unable to associate the given file + * with a Java element. + * + *

The file must be one of:

+ *

+ * Creating a Java element has the side effect of creating and opening all of the + * element's parents if they are not yet open. + * + * @param the given file + * @return the Java element corresponding to the given file, or + * null if unable to associate the given file + * with a Java element + */ +public static IJavaElement create(IFile file) { + return JavaModelManager.create(file, null); +} +/** + * Returns the package fragment or package fragment root corresponding to the given folder, or + * null if unable to associate the given folder with a Java element. + *

+ * Note that a package fragment root is returned rather than a default package. + *

+ * Creating a Java element has the side effect of creating and opening all of the + * element's parents if they are not yet open. + * + * @param the given folder + * @return the package fragment or package fragment root corresponding to the given folder, or + * null if unable to associate the given folder with a Java element + */ +public static IJavaElement create(IFolder folder) { + return JavaModelManager.create(folder, null); +} +/** + * Returns the Java project corresponding to the given project. + *

+ * Creating a Java Project has the side effect of creating and opening all of the + * project's parents if they are not yet open. + *

+ * Note that no check is done at this time on the existence or the java nature of this project. + * + * @param project the given project + * @return the Java project corresponding to the given project, null if the given project is null + */ +public static IJavaProject create(IProject project) { + if (project == null) { + return null; } - /** - * Creates and returns a class file element for - * the given .class file. Returns null if unable - * to recognize the class file. - * - * @param file the given .class file - * @return a class file element for the given .class file, or null if unable - * to recognize the class file - */ -// public static IClassFile createClassFileFrom(IFile file) { -// return JavaModelManager.createClassFileFrom(file, null); -// } - /** - * Creates and returns a compilation unit element for - * the given .java file. Returns null if unable - * to recognize the compilation unit. - * - * @param file the given .java file - * @return a compilation unit element for the given .java file, or null if unable - * to recognize the compilation unit - */ - public static ICompilationUnit createCompilationUnitFrom(IFile file) { - return JavaModelManager.createCompilationUnitFrom(file, null); + JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel(); + return javaModel.getJavaProject(project); +} +/** + * Returns the Java element corresponding to the given resource, or + * null if unable to associate the given resource + * with a Java element. + *

+ * The resource must be one of:

+ *

+ * Creating a Java element has the side effect of creating and opening all of the + * element's parents if they are not yet open. + * + * @param resource the given resource + * @return the Java element corresponding to the given resource, or + * null if unable to associate the given resource + * with a Java element + */ +public static IJavaElement create(IResource resource) { + return JavaModelManager.create(resource, null); +} +/** + * Returns the Java model. + * + * @param root the given root + * @return the Java model, or null if the root is null + */ +public static IJavaModel create(IWorkspaceRoot root) { + if (root == null) { + return null; } - /** - * Creates and returns a handle for the given JAR file. - * The Java model associated with the JAR's project may be - * created as a side effect. - * - * @param file the given JAR file - * @return a handle for the given JAR file, or null if unable to create a JAR package fragment root. - * (for example, if the JAR file represents a non-Java resource) - */ -// public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) { -// return JavaModelManager.createJarPackageFragmentRootFrom(file, null); -// } - - /** - * Answers the project specific value for a given classpath container. - * In case this container path could not be resolved, then will answer null. - * Both the container path and the project context are supposed to be non-null. - *

- * The containerPath is a formed by a first ID segment followed with extra segments, which can be - * used as additional hints for resolution. If no container was ever recorded for this container path - * onto this project (using setClasspathContainer, then a - * ClasspathContainerInitializer will be activated if any was registered for this container - * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that the returned container must answer the exact same containerPath - * when requested IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * @param containerPath the name of the container, which needs to be resolved - * @param project a specific project in which the container is being resolved - * @return the corresponding classpath container or null if unable to find one. - * - * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container - * contains illegal entries (contains CPE_CONTAINER entries or null entries). - * - * @see ClasspathContainerInitializer - * @see IClasspathContainer - * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @since 2.0 - */ -// public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException { -// -// IClasspathContainer container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// -// if (container == null){ -// final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); -// if (initializer != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ -// new Exception("FAKE exception for dumping current CPContainer (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ -// } -// JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles -// boolean ok = false; -// try { -// // wrap initializer call with Safe runnable in case initializer would be causing some grief -// Platform.run(new ISafeRunnable() { -// public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$ -// } -// public void run() throws Exception { -// initializer.initialize(containerPath, project); -// } -// }); -// -// // retrieve value (if initialization was successful) -// container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// ok = true; -// } finally { -// if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache -// } -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$ -// if (container != null){ -// System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$ -// IClasspathEntry[] entries = container.getClasspathEntries(); -// if (entries != null){ -// for (int i = 0; i < entries.length; i++){ -// if (i > 0) System.out.println(", ");//$NON-NLS-1$ -// System.out.println(entries[i]); -// } -// } -// System.out.println("}");//$NON-NLS-1$ -// } else { -// System.out.println("{unbound}");//$NON-NLS-1$ -// } -// } -// } else { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// } -// } -// return container; -// } - - /** - * Helper method finding the classpath container initializer registered for a given classpath container ID - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A containerID is the first segment of any container path, used to identify the registered container initializer. - *

- * @param String - a containerID identifying a registered initializer - * @return ClasspathContainerInitializer - the registered classpath container initializer or null if - * none was found. - * @since 2.1 - */ -// public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){ -// -// Plugin jdtCorePlugin = JavaCore.getPlugin(); -// if (jdtCorePlugin == null) return null; + return JavaModelManager.getJavaModelManager().getJavaModel(); +} +/** + * Creates and returns a class file element for + * the given .class file. Returns null if unable + * to recognize the class file. + * + * @param file the given .class file + * @return a class file element for the given .class file, or null if unable + * to recognize the class file + */ +//public static IClassFile createClassFileFrom(IFile file) { +// return JavaModelManager.createClassFileFrom(file, null); +//} +/** + * Creates and returns a compilation unit element for + * the given .java file. Returns null if unable + * to recognize the compilation unit. + * + * @param file the given .java file + * @return a compilation unit element for the given .java file, or null if unable + * to recognize the compilation unit + */ +public static ICompilationUnit createCompilationUnitFrom(IFile file) { + return JavaModelManager.createCompilationUnitFrom(file, null); +} +/** + * Creates and returns a handle for the given JAR file. + * The Java model associated with the JAR's project may be + * created as a side effect. + * + * @param file the given JAR file + * @return a handle for the given JAR file, or null if unable to create a JAR package fragment root. + * (for example, if the JAR file represents a non-Java resource) + */ +//public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) { +// return JavaModelManager.createJarPackageFragmentRootFrom(file, null); +//} + +/** + * Answers the project specific value for a given classpath container. + * In case this container path could not be resolved, then will answer null. + * Both the container path and the project context are supposed to be non-null. + *

+ * The containerPath is a formed by a first ID segment followed with extra segments, which can be + * used as additional hints for resolution. If no container was ever recorded for this container path + * onto this project (using setClasspathContainer, then a + * ClasspathContainerInitializer will be activated if any was registered for this container + * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * There is no assumption that the returned container must answer the exact same containerPath + * when requested IClasspathContainer#getPath. + * Indeed, the containerPath is just an indication for resolving it to an actual container object. + *

+ * Classpath container values are persisted locally to the workspace, but + * are not preserved from a session to another. It is thus highly recommended to register a + * ClasspathContainerInitializer for each referenced container + * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). + *

+ * @param containerPath the name of the container, which needs to be resolved + * @param project a specific project in which the container is being resolved + * @return the corresponding classpath container or null if unable to find one. + * + * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container + * contains illegal entries (contains CPE_CONTAINER entries or null entries). + * + * @see ClasspathContainerInitializer + * @see IClasspathContainer + * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) + * @since 2.0 + */ +//public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException { // -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ -// String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ -// if (initializerID != null && initializerID.equals(containerID)){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// try { -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathContainerInitializer){ -// return (ClasspathContainerInitializer)execExt; -// } -// } catch(CoreException e) { -// } -// } -// } -// } -// } -// return null; -// } - - /** - * Returns the path held in the given classpath variable. - * Returns null if unable to bind. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Note that classpath variables can be contributed registered initializers for, - * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * If an initializer is registered for a variable, its persisted value will be ignored: - * its initializer will thus get the opportunity to rebind the variable differently on - * each session. - * - * @param variableName the name of the classpath variable - * @return the path, or null if none - * @see #setClasspathVariable - */ -// public static IPath getClasspathVariable(final String variableName) { -// -// IPath variablePath = JavaModelManager.variableGet(variableName); -// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle -// -// if (variablePath != null) { -// return variablePath; -// } +// IClasspathContainer container = JavaModelManager.containerGet(project, containerPath); +// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle // -// // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused -// final ClasspathVariableInitializer initializer = JavaCore.getClasspathVariableInitializer(variableName); +// if (container == null){ +// final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); // if (initializer != null){ // if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$ -// new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$ +// System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ +// new Exception("FAKE exception for dumping current CPContainer (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ // } -// JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles +// JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles // boolean ok = false; // try { // // wrap initializer call with Safe runnable in case initializer would be causing some grief // Platform.run(new ISafeRunnable() { // public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$ +// Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$ // } // public void run() throws Exception { -// initializer.initialize(variableName); +// initializer.initialize(containerPath, project); // } // }); -// variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect -// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call) -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$ -// } +// +// // retrieve value (if initialization was successful) +// container = JavaModelManager.containerGet(project, containerPath); +// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle // ok = true; // } finally { -// if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache +// if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache +// } +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$ +// if (container != null){ +// System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$ +// IClasspathEntry[] entries = container.getClasspathEntries(); +// if (entries != null){ +// for (int i = 0; i < entries.length; i++){ +// if (i > 0) System.out.println(", ");//$NON-NLS-1$ +// System.out.println(entries[i]); +// } +// } +// System.out.println("}");//$NON-NLS-1$ +// } else { +// System.out.println("{unbound}");//$NON-NLS-1$ +// } // } // } else { // if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$ +// System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$ // } // } -// return variablePath; // } +// return container; +//} - /** - * Helper method finding the classpath variable initializer registered for a given classpath variable name - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - *

- * @param the given variable - * @return ClasspathVariableInitializer - the registered classpath variable initializer or null if - * none was found. - * @since 2.1 - */ -// public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){ +/** + * Helper method finding the classpath container initializer registered for a given classpath container ID + * or null if none was found while iterating over the contributions to extension point to + * the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * A containerID is the first segment of any container path, used to identify the registered container initializer. + *

+ * @param String - a containerID identifying a registered initializer + * @return ClasspathContainerInitializer - the registered classpath container initializer or null if + * none was found. + * @since 2.1 + */ +//public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){ // -// Plugin jdtCorePlugin = JavaCore.getPlugin(); -// if (jdtCorePlugin == null) return null; +// Plugin jdtCorePlugin = JavaCore.getPlugin(); +// if (jdtCorePlugin == null) return null; // -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ +// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); +// if (extension != null) { +// IExtension[] extensions = extension.getExtensions(); +// for(int i = 0; i < extensions.length; i++){ +// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); +// for(int j = 0; j < configElements.length; j++){ +// String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ +// if (initializerID != null && initializerID.equals(containerID)){ +// if (JavaModelManager.CP_RESOLVE_VERBOSE) { +// System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ +// } // try { -// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ -// if (variable.equals(varAttribute)) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathVariableInitializer){ -// return (ClasspathVariableInitializer)execExt; -// } +// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ +// if (execExt instanceof ClasspathContainerInitializer){ +// return (ClasspathContainerInitializer)execExt; // } -// } catch(CoreException e){ -// } +// } catch(CoreException e) { // } -// } -// } -// return null; -// } +// } +// } +// } +// } +// return null; +//} + +/** + * Returns the path held in the given classpath variable. + * Returns null if unable to bind. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * Note that classpath variables can be contributed registered initializers for, + * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * If an initializer is registered for a variable, its persisted value will be ignored: + * its initializer will thus get the opportunity to rebind the variable differently on + * each session. + * + * @param variableName the name of the classpath variable + * @return the path, or null if none + * @see #setClasspathVariable + */ +public static IPath getClasspathVariable(final String variableName) { - /** - * Returns the names of all known classpath variables. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @return the list of classpath variable names - * @see #setClasspathVariable - */ -// public static String[] getClasspathVariableNames() { -// return JavaModelManager.variableNames(); + IPath variablePath = JavaModelManager.variableGet(variableName); + if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle + + if (variablePath != null) { + return variablePath; + } + + // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused +// final ClasspathVariableInitializer initializer = PHPCore.getClasspathVariableInitializer(variableName); +// if (initializer != null){ +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$ +// new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$ +// } +// JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles +// boolean ok = false; +// try { +// // wrap initializer call with Safe runnable in case initializer would be causing some grief +// Platform.run(new ISafeRunnable() { +// public void handleException(Throwable exception) { +// Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$ +// } +// public void run() throws Exception { +// initializer.initialize(variableName); +// } +// }); +// variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect +// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call) +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$ +// } +// ok = true; +// } finally { +// if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache +// } +// } else { +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$ +// } // } + return variablePath; +} - /** - * Returns a table of all known configurable options with their default values. - * These options allow to configure the behaviour of the underlying components. - * The client may safely use the result as a template that they can modify and - * then pass to setOptions. - * - * Helper constants have been defined on JavaCore for each of the option ID and - * their possible constant values. - * - * Note: more options might be added in further releases. - *

-	 * RECOGNIZED OPTIONS:
-	 * COMPILER / Generating Local Variable Debug Attribute
- 	 *    When generated, this attribute will enable local variable names 
-	 *    to be displayed in debugger, only in place where variables are 
-	 *    definitely assigned (.class file is then bigger)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
-	 *     - possible values:   { "generate", "do not generate" }
-	 *     - default:           "generate"
-	 *
-	 * COMPILER / Generating Line Number Debug Attribute 
-	 *    When generated, this attribute will enable source code highlighting in debugger 
-	 *    (.class file is then bigger).
-	 *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
-	 *     - possible values:   { "generate", "do not generate" }
-	 *     - default:           "generate"
-	 *    
-	 * COMPILER / Generating Source Debug Attribute 
-	 *    When generated, this attribute will enable the debugger to present the 
-	 *    corresponding source code.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
-	 *     - possible values:   { "generate", "do not generate" }
-	 *     - default:           "generate"
-	 *    
-	 * COMPILER / Preserving Unused Local Variables
-	 *    Unless requested to preserve unused local variables (that is, never read), the 
-	 *    compiler will optimize them out, potentially altering debugging
-	 *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
-	 *     - possible values:   { "preserve", "optimize out" }
-	 *     - default:           "preserve"
-	 * 
-	 * COMPILER / Defining Target Java Platform
-	 *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
-	 *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
-	 *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
-	 *     - default:           "1.1"
-	 *
-	 * COMPILER / Reporting Unreachable Code
-	 *    Unreachable code can optionally be reported as an error, warning or simply 
-	 *    ignored. The bytecode generation will always optimized it out.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "error"
-	 *
-	 * COMPILER / Reporting Invalid Import
-	 *    An import statement that cannot be resolved might optionally be reported 
-	 *    as an error, as a warning or ignored.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "error"
-	 *
-	 * COMPILER / Reporting Attempt to Override Package-Default Method
-	 *    A package default method is not visible in a different package, and thus 
-	 *    cannot be overridden. When enabling this option, the compiler will signal 
-	 *    such scenarii either as an error or a warning.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Method With Constructor Name
-	 *    Naming a method with a constructor name is generally considered poor 
-	 *    style programming. When enabling this option, the compiler will signal such 
-	 *    scenarii either as an error or a warning.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Deprecation
-	 *    When enabled, the compiler will signal use of deprecated API either as an 
-	 *    error or a warning.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Deprecation Inside Deprecated Code
-	 *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
-	 *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 *
-	 * COMPILER / Reporting Hidden Catch Block
-	 *    Locally to a try statement, some catch blocks may hide others . For example,
-	 *      try {  throw new java.io.CharConversionException();
-	 *      } catch (java.io.CharConversionException e) {
-	 *      } catch (java.io.IOException e) {}. 
-	 *    When enabling this option, the compiler will issue an error or a warning for hidden 
-	 *    catch blocks corresponding to checked exceptions
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Unused Local
-	 *    When enabled, the compiler will issue an error or a warning for unused local 
-	 *    variables (that is, variables never read from)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Unused Parameter
-	 *    When enabled, the compiler will issue an error or a warning for unused method 
-	 *    parameters (that is, parameters never read from)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
-	 *    When enabled, the compiler will signal unused parameters in abstract method implementations.
-	 *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 *
-	 * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
-	 *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
-	 *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 *
-	 * COMPILER / Reporting Unused Import
-	 *    When enabled, the compiler will issue an error or a warning for unused import 
-	 *    reference 
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Unused Private Members
-	 *    When enabled, the compiler will issue an error or a warning whenever a private 
-	 *    method or field is declared but never used within the same unit.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Synthetic Access Emulation
-	 *    When enabled, the compiler will issue an error or a warning whenever it emulates 
-	 *    access to a non-accessible member of an enclosing type. Such access can have
-	 *    performance implications.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Non-Externalized String Literal
-	 *    When enabled, the compiler will issue an error or a warning for non externalized 
-	 *    String literal (that is, not tagged with //$NON-NLS-$). 
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 * 
-	 * COMPILER / Reporting Usage of 'assert' Identifier
-	 *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
-	 *    used as an identifier (reserved keyword in 1.4)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 * 
-	 * COMPILER / Reporting Non-Static Reference to a Static Member
-	 *    When enabled, the compiler will issue an error or a warning whenever a static field
-	 *    or method is accessed with an expression receiver. A reference to a static member should
-	 *    be qualified with a type name.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 * 
-	 * COMPILER / Reporting Assignment with no Effect
-	 *    When enabled, the compiler will issue an error or a warning whenever an assignment
-	 *    has no effect (e.g 'x = x').
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 * 
-	 * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
-	 *    When enabled, the compiler will issue an error or a warning whenever an interface
-	 *    defines a method incompatible with a non-inherited Object method. Until this conflict
-	 *    is resolved, such an interface cannot be implemented, For example, 
-	 *      interface I { 
-	 *         int clone();
-	 *      } 
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 * 
-	 * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
-	 *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
-	 *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Setting Source Compatibility Mode
-	 *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
-	 *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
-	 *   level should be set to "1.4" and the compliance mode should be "1.4".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.source"
-	 *     - possible values:   { "1.3", "1.4" }
-	 *     - default:           "1.3"
-	 * 
-	 * COMPILER / Setting Compliance Level
-	 *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
-	 *    should not go beyond "1.3" level.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
-	 *     - possible values:   { "1.3", "1.4" }
-	 *     - default:           "1.3"
-	 * 
-	 * COMPILER / Maximum number of problems reported per compilation unit
-	 *    Specify the maximum number of problems reported on each compilation unit.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
-	 *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
-	 *     - default:           "100"
-	 * 
-	 * COMPILER / Define the Automatic Task Tags
-	 *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
-	 *    one of the corresponding tag inside any comment in Java source code.
-	 *    Generated task messages will include the tag, and range until the next line separator or comment ending.
-	 *    Note that tasks messages are trimmed.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card or leading/trailing spaces 
-	 *     - default:           ""
-	 * 
-	 * COMPILER / Define the Automatic Task Priorities
-	 *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
-	 *    of the task markers issued by the compiler.
-	 *    If the default is specified, the priority of each task marker is "NORMAL".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
-	 *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
-	 *     - default:           ""
-	 *
-	 * BUILDER / Specifying Filters for Resource Copying Control
-	 *    Allow to specify some filters to control the resource copy process.
-	 *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
-	 *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
-	 *       or the name of a folder which ends with '/'
-	 *     - default:           ""
-	 * 
-	 * BUILDER / Abort if Invalid Classpath
-	 *    Allow to toggle the builder to abort if the classpath is invalid
-	 *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
-	 *     - possible values:   { "abort", "ignore" }
-	 *     - default:           "abort"
-	 * 
-	 * BUILDER / Cleaning Output Folder(s)
-	 *    Indicate whether the JavaBuilder is allowed to clean the output folders
-	 *    when performing full build operations.
-	 *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
-	 *     - possible values:   { "clean", "ignore" }
-	 *     - default:           "clean"
-	 * 
-	 * BUILDER / Reporting Duplicate Resources
-	 *    Indicate the severity of the problem reported when more than one occurrence
-	 *    of a resource is to be copied into the output location.
-	 *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
-	 *     - possible values:   { "error", "warning" }
-	 *     - default:           "warning"
-	 * 
-	 * JAVACORE / Computing Project Build Order
-	 *    Indicate whether JavaCore should enforce the project build order to be based on
-	 *    the classpath prerequisite chain. When requesting to compute, this takes over
-	 *    the platform default order (based on project references).
-	 *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
-	 *     - possible values:   { "compute", "ignore" }
-	 *     - default:           "ignore"	 
-	 * 
-	 * JAVACORE / Specify Default Source Encoding Format
-	 *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
-	 *    to 'ResourcesPlugin.getEncoding()'.
-	 *     - option id:         "org.eclipse.jdt.core.encoding"
-	 *     - possible values:   { any of the supported encoding name}.
-	 *     - default:           
-	 * 
-	 * JAVACORE / Reporting Incomplete Classpath
-	 *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
-	 *    is not legite or is not visible (for example, a referenced project is closed).
-	 *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
-	 *     - possible values:   { "error", "warning"}
-	 *     - default:           "error"
-	 * 
-	 * JAVACORE / Reporting Classpath Cycle
-	 *    Indicate the severity of the problem reported when a project is involved in a cycle.
-	 *     - option id:         "org.eclipse.jdt.core.circularClasspath"
-	 *     - possible values:   { "error", "warning" }
-	 *     - default:           "error"
-	 * 
-	 * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
-	 *    When disabled, no entry on a project classpath can be associated with
-	 *    an exclusion pattern.
-	 *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "enabled"
-	 * 
-	 * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
-	 *    When disabled, no entry on a project classpath can be associated with
-	 *    a specific output location, preventing thus usage of multiple output locations.
-	 *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "enabled"
-	 * 
-	 *	FORMATTER / Inserting New Line Before Opening Brace
-	 *    When Insert, a new line is inserted before an opening brace, otherwise nothing
-	 *    is inserted
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "do not insert"
-	 * 
-	 *	FORMATTER / Inserting New Line Inside Control Statement
-	 *    When Insert, a new line is inserted between } and following else, catch, finally
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "do not insert"
-	 * 
-	 *	FORMATTER / Clearing Blank Lines
-	 *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
-	 *    and all others removed.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
-	 *     - possible values:   { "clear all", "preserve one" }
-	 *     - default:           "preserve one"
-	 * 
-	 *	FORMATTER / Inserting New Line Between Else/If 
-	 *    When Insert, a blank line is inserted between an else and an if when they are 
-	 *    contiguous. When choosing to not insert, else-if will be kept on the same
-	 *    line when possible.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "do not insert"
-	 * 
-	 *	FORMATTER / Inserting New Line In Empty Block
-	 *    When insert, a line break is inserted between contiguous { and }, if } is not followed
-	 *    by a keyword.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "insert"
-	 * 
-	 *	FORMATTER / Splitting Lines Exceeding Length
-	 *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
-	 *    disable line splitting
-	 *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
-	 *     - possible values:	"", where n is zero or a positive integer
-	 *     - default:           "80"
-	 * 
-	 *	FORMATTER / Compacting Assignment
-	 *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
-	 *    is inserted before the assignment operator
-	 *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
-	 *     - possible values:   { "compact", "normal" }
-	 *     - default:           "normal"
-	 * 
-	 *	FORMATTER / Defining Indentation Character
-	 *    Either choose to indent with tab characters or spaces
-	 *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
-	 *     - possible values:   { "tab", "space" }
-	 *     - default:           "tab"
-	 * 
-	 *	FORMATTER / Defining Space Indentation Length
-	 *    When using spaces, set the amount of space characters to use for each 
-	 *    indentation mark.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
-	 *     - possible values:	"", where n is a positive integer
-	 *     - default:           "4"
-	 * 
-	 *	FORMATTER / Inserting space in cast expression
-	 *    When Insert, a space is added between the type and the expression in a cast expression.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "insert"
-	 * 
-	 *	CODEASSIST / Activate Visibility Sensitive Completion
-	 *    When active, completion doesn't show that you can not see
-	 *    (for example, you can not see private methods of a super class).
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 * 
-	 *	CODEASSIST / Automatic Qualification of Implicit Members
-	 *    When active, completion automatically qualifies completion on implicit
-	 *    field references and message expressions.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Field Name
-	 *    When the prefixes is non empty, completion for field name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Static Field Name
-	 *    When the prefixes is non empty, completion for static field name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Local Variable Name
-	 *    When the prefixes is non empty, completion for local variable name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Argument Name
-	 *    When the prefixes is non empty, completion for argument name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Field Name
-	 *    When the suffixes is non empty, completion for field name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Static Field Name
-	 *    When the suffixes is non empty, completion for static field name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Local Variable Name
-	 *    When the suffixes is non empty, completion for local variable name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Argument Name
-	 *    When the suffixes is non empty, completion for argument name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
- * - * @return a mutable table containing the default settings of all known options - * (key type: String; value type: String) - * @see #setOptions - */ - public static Hashtable getDefaultOptions(){ +/** + * Helper method finding the classpath variable initializer registered for a given classpath variable name + * or null if none was found while iterating over the contributions to extension point to + * the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + *

+ * @param the given variable + * @return ClasspathVariableInitializer - the registered classpath variable initializer or null if + * none was found. + * @since 2.1 + */ +public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){ + + Plugin jdtCorePlugin = JavaCore.getPlugin(); + if (jdtCorePlugin == null) return null; + +// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); +// if (extension != null) { +// IExtension[] extensions = extension.getExtensions(); +// for(int i = 0; i < extensions.length; i++){ +// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); +// for(int j = 0; j < configElements.length; j++){ +// try { +// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ +// if (variable.equals(varAttribute)) { +// if (JavaModelManager.CP_RESOLVE_VERBOSE) { +// System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ +// } +// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ +// if (execExt instanceof ClasspathVariableInitializer){ +// return (ClasspathVariableInitializer)execExt; +// } +// } +// } catch(CoreException e){ +// } +// } +// } +// } + return null; +} - Hashtable defaultOptions = new Hashtable(10); +/** + * Returns the names of all known classpath variables. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @return the list of classpath variable names + * @see #setClasspathVariable + */ +//public static String[] getClasspathVariableNames() { +// return JavaModelManager.variableNames(); +//} - // see #initializeDefaultPluginPreferences() for changing default settings +/** + * Returns a table of all known configurable options with their default values. + * These options allow to configure the behaviour of the underlying components. + * The client may safely use the result as a template that they can modify and + * then pass to setOptions. + * + * Helper constants have been defined on JavaCore for each of the option ID and + * their possible constant values. + * + * Note: more options might be added in further releases. + *

+ * RECOGNIZED OPTIONS:
+ * COMPILER / Generating Local Variable Debug Attribute
+ *    When generated, this attribute will enable local variable names 
+ *    to be displayed in debugger, only in place where variables are 
+ *    definitely assigned (.class file is then bigger)
+ *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
+ *     - possible values:   { "generate", "do not generate" }
+ *     - default:           "generate"
+ *
+ * COMPILER / Generating Line Number Debug Attribute 
+ *    When generated, this attribute will enable source code highlighting in debugger 
+ *    (.class file is then bigger).
+ *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
+ *     - possible values:   { "generate", "do not generate" }
+ *     - default:           "generate"
+ *    
+ * COMPILER / Generating Source Debug Attribute 
+ *    When generated, this attribute will enable the debugger to present the 
+ *    corresponding source code.
+ *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
+ *     - possible values:   { "generate", "do not generate" }
+ *     - default:           "generate"
+ *    
+ * COMPILER / Preserving Unused Local Variables
+ *    Unless requested to preserve unused local variables (that is, never read), the 
+ *    compiler will optimize them out, potentially altering debugging
+ *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
+ *     - possible values:   { "preserve", "optimize out" }
+ *     - default:           "preserve"
+ * 
+ * COMPILER / Defining Target Java Platform
+ *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+ *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
+ *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
+ *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
+ *     - default:           "1.1"
+ *
+ * COMPILER / Reporting Unreachable Code
+ *    Unreachable code can optionally be reported as an error, warning or simply 
+ *    ignored. The bytecode generation will always optimized it out.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "error"
+ *
+ * COMPILER / Reporting Invalid Import
+ *    An import statement that cannot be resolved might optionally be reported 
+ *    as an error, as a warning or ignored.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "error"
+ *
+ * COMPILER / Reporting Attempt to Override Package-Default Method
+ *    A package default method is not visible in a different package, and thus 
+ *    cannot be overridden. When enabling this option, the compiler will signal 
+ *    such scenarii either as an error or a warning.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Method With Constructor Name
+ *    Naming a method with a constructor name is generally considered poor 
+ *    style programming. When enabling this option, the compiler will signal such 
+ *    scenarii either as an error or a warning.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Deprecation
+ *    When enabled, the compiler will signal use of deprecated API either as an 
+ *    error or a warning.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Deprecation Inside Deprecated Code
+ *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
+ *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ *
+ * COMPILER / Reporting Hidden Catch Block
+ *    Locally to a try statement, some catch blocks may hide others . For example,
+ *      try {  throw new java.io.CharConversionException();
+ *      } catch (java.io.CharConversionException e) {
+ *      } catch (java.io.IOException e) {}. 
+ *    When enabling this option, the compiler will issue an error or a warning for hidden 
+ *    catch blocks corresponding to checked exceptions
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Unused Local
+ *    When enabled, the compiler will issue an error or a warning for unused local 
+ *    variables (that is, variables never read from)
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Unused Parameter
+ *    When enabled, the compiler will issue an error or a warning for unused method 
+ *    parameters (that is, parameters never read from)
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
+ *    When enabled, the compiler will signal unused parameters in abstract method implementations.
+ *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ *
+ * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
+ *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
+ *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ *
+ * COMPILER / Reporting Unused Import
+ *    When enabled, the compiler will issue an error or a warning for unused import 
+ *    reference 
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Unused Private Members
+ *    When enabled, the compiler will issue an error or a warning whenever a private 
+ *    method or field is declared but never used within the same unit.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Synthetic Access Emulation
+ *    When enabled, the compiler will issue an error or a warning whenever it emulates 
+ *    access to a non-accessible member of an enclosing type. Such access can have
+ *    performance implications.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Non-Externalized String Literal
+ *    When enabled, the compiler will issue an error or a warning for non externalized 
+ *    String literal (that is, not tagged with //$NON-NLS-$). 
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ * 
+ * COMPILER / Reporting Usage of 'assert' Identifier
+ *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
+ *    used as an identifier (reserved keyword in 1.4)
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ * 
+ * COMPILER / Reporting Non-Static Reference to a Static Member
+ *    When enabled, the compiler will issue an error or a warning whenever a static field
+ *    or method is accessed with an expression receiver. A reference to a static member should
+ *    be qualified with a type name.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ * 
+ * COMPILER / Reporting Assignment with no Effect
+ *    When enabled, the compiler will issue an error or a warning whenever an assignment
+ *    has no effect (e.g 'x = x').
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ * 
+ * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
+ *    When enabled, the compiler will issue an error or a warning whenever an interface
+ *    defines a method incompatible with a non-inherited Object method. Until this conflict
+ *    is resolved, such an interface cannot be implemented, For example, 
+ *      interface I { 
+ *         int clone();
+ *      } 
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ * 
+ * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
+ *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
+ *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Setting Source Compatibility Mode
+ *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
+ *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+ *   level should be set to "1.4" and the compliance mode should be "1.4".
+ *     - option id:         "org.eclipse.jdt.core.compiler.source"
+ *     - possible values:   { "1.3", "1.4" }
+ *     - default:           "1.3"
+ * 
+ * COMPILER / Setting Compliance Level
+ *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
+ *    should not go beyond "1.3" level.
+ *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
+ *     - possible values:   { "1.3", "1.4" }
+ *     - default:           "1.3"
+ * 
+ * COMPILER / Maximum number of problems reported per compilation unit
+ *    Specify the maximum number of problems reported on each compilation unit.
+ *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
+ *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
+ *     - default:           "100"
+ * 
+ * COMPILER / Define the Automatic Task Tags
+ *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
+ *    one of the corresponding tag inside any comment in Java source code.
+ *    Generated task messages will include the tag, and range until the next line separator or comment ending.
+ *    Note that tasks messages are trimmed.
+ *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card or leading/trailing spaces 
+ *     - default:           ""
+ * 
+ * COMPILER / Define the Automatic Task Priorities
+ *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
+ *    of the task markers issued by the compiler.
+ *    If the default is specified, the priority of each task marker is "NORMAL".
+ *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
+ *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
+ *     - default:           ""
+ *
+ * BUILDER / Specifying Filters for Resource Copying Control
+ *    Allow to specify some filters to control the resource copy process.
+ *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
+ *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
+ *       or the name of a folder which ends with '/'
+ *     - default:           ""
+ * 
+ * BUILDER / Abort if Invalid Classpath
+ *    Allow to toggle the builder to abort if the classpath is invalid
+ *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
+ *     - possible values:   { "abort", "ignore" }
+ *     - default:           "abort"
+ * 
+ * BUILDER / Cleaning Output Folder(s)
+ *    Indicate whether the JavaBuilder is allowed to clean the output folders
+ *    when performing full build operations.
+ *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
+ *     - possible values:   { "clean", "ignore" }
+ *     - default:           "clean"
+ * 
+ * BUILDER / Reporting Duplicate Resources
+ *    Indicate the severity of the problem reported when more than one occurrence
+ *    of a resource is to be copied into the output location.
+ *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
+ *     - possible values:   { "error", "warning" }
+ *     - default:           "warning"
+ * 
+ * JAVACORE / Computing Project Build Order
+ *    Indicate whether JavaCore should enforce the project build order to be based on
+ *    the classpath prerequisite chain. When requesting to compute, this takes over
+ *    the platform default order (based on project references).
+ *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
+ *     - possible values:   { "compute", "ignore" }
+ *     - default:           "ignore"	 
+ * 
+ * JAVACORE / Specify Default Source Encoding Format
+ *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
+ *    to 'ResourcesPlugin.getEncoding()'.
+ *     - option id:         "org.eclipse.jdt.core.encoding"
+ *     - possible values:   { any of the supported encoding name}.
+ *     - default:           
+ * 
+ * JAVACORE / Reporting Incomplete Classpath
+ *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
+ *    is not legite or is not visible (for example, a referenced project is closed).
+ *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
+ *     - possible values:   { "error", "warning"}
+ *     - default:           "error"
+ * 
+ * JAVACORE / Reporting Classpath Cycle
+ *    Indicate the severity of the problem reported when a project is involved in a cycle.
+ *     - option id:         "org.eclipse.jdt.core.circularClasspath"
+ *     - possible values:   { "error", "warning" }
+ *     - default:           "error"
+ * 
+ * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
+ *    When disabled, no entry on a project classpath can be associated with
+ *    an exclusion pattern.
+ *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "enabled"
+ * 
+ * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
+ *    When disabled, no entry on a project classpath can be associated with
+ *    a specific output location, preventing thus usage of multiple output locations.
+ *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "enabled"
+ * 
+ *	FORMATTER / Inserting New Line Before Opening Brace
+ *    When Insert, a new line is inserted before an opening brace, otherwise nothing
+ *    is inserted
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "do not insert"
+ * 
+ *	FORMATTER / Inserting New Line Inside Control Statement
+ *    When Insert, a new line is inserted between } and following else, catch, finally
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "do not insert"
+ * 
+ *	FORMATTER / Clearing Blank Lines
+ *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
+ *    and all others removed.
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
+ *     - possible values:   { "clear all", "preserve one" }
+ *     - default:           "preserve one"
+ * 
+ *	FORMATTER / Inserting New Line Between Else/If 
+ *    When Insert, a blank line is inserted between an else and an if when they are 
+ *    contiguous. When choosing to not insert, else-if will be kept on the same
+ *    line when possible.
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "do not insert"
+ * 
+ *	FORMATTER / Inserting New Line In Empty Block
+ *    When insert, a line break is inserted between contiguous { and }, if } is not followed
+ *    by a keyword.
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "insert"
+ * 
+ *	FORMATTER / Splitting Lines Exceeding Length
+ *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
+ *    disable line splitting
+ *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
+ *     - possible values:	"", where n is zero or a positive integer
+ *     - default:           "80"
+ * 
+ *	FORMATTER / Compacting Assignment
+ *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
+ *    is inserted before the assignment operator
+ *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
+ *     - possible values:   { "compact", "normal" }
+ *     - default:           "normal"
+ * 
+ *	FORMATTER / Defining Indentation Character
+ *    Either choose to indent with tab characters or spaces
+ *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
+ *     - possible values:   { "tab", "space" }
+ *     - default:           "tab"
+ * 
+ *	FORMATTER / Defining Space Indentation Length
+ *    When using spaces, set the amount of space characters to use for each 
+ *    indentation mark.
+ *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
+ *     - possible values:	"", where n is a positive integer
+ *     - default:           "4"
+ * 
+ *	FORMATTER / Inserting space in cast expression
+ *    When Insert, a space is added between the type and the expression in a cast expression.
+ *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "insert"
+ * 
+ *	CODEASSIST / Activate Visibility Sensitive Completion
+ *    When active, completion doesn't show that you can not see
+ *    (for example, you can not see private methods of a super class).
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ * 
+ *	CODEASSIST / Automatic Qualification of Implicit Members
+ *    When active, completion automatically qualifies completion on implicit
+ *    field references and message expressions.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ * 
+ *  CODEASSIST / Define the Prefixes for Field Name
+ *    When the prefixes is non empty, completion for field name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Prefixes for Static Field Name
+ *    When the prefixes is non empty, completion for static field name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Prefixes for Local Variable Name
+ *    When the prefixes is non empty, completion for local variable name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Prefixes for Argument Name
+ *    When the prefixes is non empty, completion for argument name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Field Name
+ *    When the suffixes is non empty, completion for field name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Static Field Name
+ *    When the suffixes is non empty, completion for static field name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Local Variable Name
+ *    When the suffixes is non empty, completion for local variable name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Argument Name
+ *    When the suffixes is non empty, completion for argument name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ * + * @return a mutable table containing the default settings of all known options + * (key type: String; value type: String) + * @see #setOptions + */ +public static Hashtable getDefaultOptions(){ + + Hashtable defaultOptions = new Hashtable(10); + + // see #initializeDefaultPluginPreferences() for changing default settings + Preferences preferences = getPlugin().getPluginPreferences(); + HashSet optionNames = JavaModelManager.OptionNames; + + // get preferences set to their default + String[] defaultPropertyNames = preferences.defaultPropertyNames(); + for (int i = 0; i < defaultPropertyNames.length; i++){ + String propertyName = defaultPropertyNames[i]; + if (optionNames.contains(propertyName)) { + defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + } + } + // get preferences not set to their default + String[] propertyNames = preferences.propertyNames(); + for (int i = 0; i < propertyNames.length; i++){ + String propertyName = propertyNames[i]; + if (optionNames.contains(propertyName)) { + defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + } + } + // get encoding through resource plugin + defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); + + return defaultOptions; +} + +/** + * Returns the single instance of the Java core plug-in runtime class. + * Equivalent to (JavaCore) getPlugin(). + * + * @return the single instance of the Java core plug-in runtime class + */ +public static PHPeclipsePlugin getJavaCore() { + return (PHPeclipsePlugin) getPlugin(); +} + +/** + * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) + * Note that it may answer null if this option does not exist. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param optionName the name of an option + * @return the String value of a given option + * @see JavaCore#getDefaultOptions + * @since 2.0 + */ +public static String getOption(String optionName) { + + if (CORE_ENCODING.equals(optionName)){ + return ResourcesPlugin.getEncoding(); + } + if (JavaModelManager.OptionNames.contains(optionName)){ Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; + return preferences.getString(optionName).trim(); + } + return null; +} + +/** + * Returns the table of the current options. Initially, all options have their default values, + * and this method returns a table that includes all known options. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @return table of current settings of all options + * (key type: String; value type: String) + * @see JavaCore#getDefaultOptions + */ +public static Hashtable getOptions() { + Hashtable options = new Hashtable(10); + + // see #initializeDefaultPluginPreferences() for changing default settings + Plugin plugin = getPlugin(); + if (plugin != null) { + Preferences preferences = getPlugin().getPluginPreferences(); + HashSet optionNames = JavaModelManager.OptionNames; + // get preferences set to their default String[] defaultPropertyNames = preferences.defaultPropertyNames(); for (int i = 0; i < defaultPropertyNames.length; i++){ String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + if (optionNames.contains(propertyName)){ + options.put(propertyName, preferences.getDefaultString(propertyName)); } } // get preferences not set to their default String[] propertyNames = preferences.propertyNames(); for (int i = 0; i < propertyNames.length; i++){ String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + if (optionNames.contains(propertyName)){ + options.put(propertyName, preferences.getString(propertyName).trim()); } } // get encoding through resource plugin - defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - - return defaultOptions; + options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); } - - /** - * Returns the single instance of the Java core plug-in runtime class. - * Equivalent to (JavaCore) getPlugin(). - * - * @return the single instance of the Java core plug-in runtime class - */ - public static JavaCore getJavaCore() { - return (JavaCore) getPlugin(); - } - - /** - * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) - * Note that it may answer null if this option does not exist. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param optionName the name of an option - * @return the String value of a given option - * @see JavaCore#getDefaultOptions - * @since 2.0 - */ - public static String getOption(String optionName) { + return options; +} - if (CORE_ENCODING.equals(optionName)){ - return ResourcesPlugin.getEncoding(); - } - if (JavaModelManager.OptionNames.contains(optionName)){ - Preferences preferences = getPlugin().getPluginPreferences(); - return preferences.getString(optionName).trim(); - } +/** + * This is a helper method, which returns the resolved classpath entry denoted + * by a given entry (if it is a variable entry). It is obtained by resolving the variable + * reference in the first segment. Returns null if unable to resolve using + * the following algorithm: + * + *

+ * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry. + *

+ * NOTE: This helper method does not handle classpath containers, for which should rather be used + * JavaCore#getClasspathContainer(IPath, IJavaProject). + *

+ * + * @param entry the given variable entry + * @return the resolved library or project classpath entry, or null + * if the given variable entry could not be resolved to a valid classpath entry + */ +public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) { + + if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) + return entry; + + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath()); + if (resolvedPath == null) return null; - } - /** - * Returns the table of the current options. Initially, all options have their default values, - * and this method returns a table that includes all known options. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @return table of current settings of all options - * (key type: String; value type: String) - * @see JavaCore#getDefaultOptions - */ - public static Hashtable getOptions() { - - Hashtable options = new Hashtable(10); - - // see #initializeDefaultPluginPreferences() for changing default settings - Plugin plugin = getPlugin(); - if (plugin != null) { - Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // get preferences set to their default - String[] defaultPropertyNames = preferences.defaultPropertyNames(); - for (int i = 0; i < defaultPropertyNames.length; i++){ - String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get preferences not set to their default - String[] propertyNames = preferences.propertyNames(); - for (int i = 0; i < propertyNames.length; i++){ - String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getString(propertyName).trim()); - } - } - // get encoding through resource plugin - options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - } - return options; - } - - /** - * Returns the single instance of the Java core plug-in runtime class. - * - * @return the single instance of the Java core plug-in runtime class - */ - public static Plugin getPlugin() { - return JAVA_CORE_PLUGIN; - } - - /** - * This is a helper method, which returns the resolved classpath entry denoted - * by a given entry (if it is a variable entry). It is obtained by resolving the variable - * reference in the first segment. Returns null if unable to resolve using - * the following algorithm: - *
    - *
  • if variable segment cannot be resolved, returns null
  • - *
  • finds a project, JAR or binary folder in the workspace at the resolved path location
  • - *
  • if none finds an external JAR file or folder outside the workspace at the resolved path location
  • - *
  • if none returns null
  • - *
- *

- * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry. - *

- * NOTE: This helper method does not handle classpath containers, for which should rather be used - * JavaCore#getClasspathContainer(IPath, IJavaProject). - *

- * - * @param entry the given variable entry - * @return the resolved library or project classpath entry, or null - * if the given variable entry could not be resolved to a valid classpath entry - */ -// public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) { -// -// if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) -// return entry; -// -// IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); -// IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath()); -// if (resolvedPath == null) -// return null; -// -// Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false); -// if (target == null) -// return null; -// -// // inside the workspace -// if (target instanceof IResource) { -// IResource resolvedResource = (IResource) target; -// if (resolvedResource != null) { -// switch (resolvedResource.getType()) { -// -// case IResource.PROJECT : -// // internal project -// return JavaCore.newProjectEntry(resolvedPath, entry.isExported()); -// -// case IResource.FILE : -// if (Util.isArchiveFileName(resolvedResource.getName())) { -// // internal binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } -// break; -// -// case IResource.FOLDER : -// // internal binary folder + Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false); + if (target == null) + return null; + + // inside the workspace + if (target instanceof IResource) { + IResource resolvedResource = (IResource) target; + if (resolvedResource != null) { + switch (resolvedResource.getType()) { + + case IResource.PROJECT : + // internal project + return JavaCore.newProjectEntry(resolvedPath, entry.isExported()); + + case IResource.FILE : +// if (Util.isArchiveFileName(resolvedResource.getName())) { +// // internal binary archive // return JavaCore.newLibraryEntry( // resolvedPath, // getResolvedVariablePath(entry.getSourceAttachmentPath()), // getResolvedVariablePath(entry.getSourceAttachmentRootPath()), // entry.isExported()); -// } -// } -// } -// // outside the workspace -// if (target instanceof File) { -// File externalFile = (File) target; -// if (externalFile.isFile()) { -// String fileName = externalFile.getName().toLowerCase(); -// if (fileName.endsWith(".jar" //$NON-NLS-1$ -// ) || fileName.endsWith(".zip" //$NON-NLS-1$ -// )) { // external binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } -// } else { // external binary folder -// if (resolvedPath.isAbsolute()){ +// } + break; + + case IResource.FOLDER : + // internal binary folder // return JavaCore.newLibraryEntry( // resolvedPath, // getResolvedVariablePath(entry.getSourceAttachmentPath()), // getResolvedVariablePath(entry.getSourceAttachmentRootPath()), // entry.isExported()); -// } + break; + } + } + } + // outside the workspace + if (target instanceof File) { + File externalFile = (File) target; + if (externalFile.isFile()) { + String fileName = externalFile.getName().toLowerCase(); +// if (fileName.endsWith(".jar" //$NON-NLS-1$ +// ) || fileName.endsWith(".zip" //$NON-NLS-1$ +// )) { // external binary archive +// return JavaCore.newLibraryEntry( +// resolvedPath, +// getResolvedVariablePath(entry.getSourceAttachmentPath()), +// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), +// entry.isExported()); // } -// } -// return null; -// } + } else { // external binary folder + if (resolvedPath.isAbsolute()){ +// return JavaCore.newLibraryEntry( +// resolvedPath, +// getResolvedVariablePath(entry.getSourceAttachmentPath()), +// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), +// entry.isExported()); + } + } + } + return null; +} - /** - * Resolve a variable path (helper method). - * - * @param variablePath the given variable path - * @return the resolved variable path or null if none - */ -// public static IPath getResolvedVariablePath(IPath variablePath) { -// -// if (variablePath == null) -// return null; -// int count = variablePath.segmentCount(); -// if (count == 0) -// return null; -// -// // lookup variable -// String variableName = variablePath.segment(0); -// IPath resolvedPath = JavaCore.getClasspathVariable(variableName); -// if (resolvedPath == null) -// return null; -// -// // append path suffix -// if (count > 1) { -// resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1)); -// } -// return resolvedPath; -// } +/** + * Resolve a variable path (helper method). + * + * @param variablePath the given variable path + * @return the resolved variable path or null if none + */ +public static IPath getResolvedVariablePath(IPath variablePath) { + + if (variablePath == null) + return null; + int count = variablePath.segmentCount(); + if (count == 0) + return null; + + // lookup variable + String variableName = variablePath.segment(0); + IPath resolvedPath = JavaCore.getClasspathVariable(variableName); + if (resolvedPath == null) + return null; + + // append path suffix + if (count > 1) { + resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1)); + } + return resolvedPath; +} - /** - * Answers the shared working copies currently registered for this buffer factory. - * Working copies can be shared by several clients using the same buffer factory,see - * IWorkingCopy.getSharedWorkingCopy. - * - * @param factory the given buffer factory - * @return the list of shared working copies for a given buffer factory - * @see IWorkingCopy - * @since 2.0 - */ - public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){ +/** + * Answers the shared working copies currently registered for this buffer factory. + * Working copies can be shared by several clients using the same buffer factory,see + * IWorkingCopy.getSharedWorkingCopy. + * + * @param factory the given buffer factory + * @return the list of shared working copies for a given buffer factory + * @see IWorkingCopy + * @since 2.0 + */ +public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){ - // if factory is null, default factory must be used - if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory(); - Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies; + // if factory is null, default factory must be used + if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory(); + Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies; - Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory); - if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy; - Collection copies = perFactoryWorkingCopies.values(); - IWorkingCopy[] result = new IWorkingCopy[copies.size()]; - copies.toArray(result); - return result; - } + Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory); + if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy; + Collection copies = perFactoryWorkingCopies.values(); + IWorkingCopy[] result = new IWorkingCopy[copies.size()]; + copies.toArray(result); + return result; +} - /** - * Initializes the default preferences settings for this plug-in. - */ - protected void initializeDefaultPluginPreferences() { +/** + * Initializes the default preferences settings for this plug-in. + */ +public static void initializeDefaultPluginPreferences() { - Preferences preferences = getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; + Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences(); + HashSet optionNames = JavaModelManager.OptionNames; - // Compiler settings - preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); - optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR); + // Compiler settings + preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); + optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR); - preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); - optionNames.add(COMPILER_LINE_NUMBER_ATTR); + preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); + optionNames.add(COMPILER_LINE_NUMBER_ATTR); - preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); - optionNames.add(COMPILER_SOURCE_FILE_ATTR); + preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); + optionNames.add(COMPILER_SOURCE_FILE_ATTR); - preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); - optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL); + preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); + optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL); - preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); - optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); + preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); + optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); - preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); - optionNames.add(COMPILER_PB_UNREACHABLE_CODE); + preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); + optionNames.add(COMPILER_PB_UNREACHABLE_CODE); - preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); - optionNames.add(COMPILER_PB_INVALID_IMPORT); + preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); + optionNames.add(COMPILER_PB_INVALID_IMPORT); - preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); - optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); + preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); + optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); - preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); - optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); + preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); + optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); - preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING); - optionNames.add(COMPILER_PB_DEPRECATION); + preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING); + optionNames.add(COMPILER_PB_DEPRECATION); - preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED); - optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); + preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED); + optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); - preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); - optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK); + preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); + optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK); - preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_LOCAL); + preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); + optionNames.add(COMPILER_PB_UNUSED_LOCAL); - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER); + preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); + optionNames.add(COMPILER_PB_UNUSED_PARAMETER); - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); + preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); + optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); + preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); + optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); - preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); - optionNames.add(COMPILER_PB_UNUSED_IMPORT); + preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); + optionNames.add(COMPILER_PB_UNUSED_IMPORT); - preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER); + preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); + optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER); - preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); - optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); + preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); + optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); - preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); - optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL); + preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); + optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL); - preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); - optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER); + preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); + optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER); - preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); - optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER); + preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); + optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER); - preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); - optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT); + preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); + optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT); - preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); - optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); + preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); + optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); - preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); - optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); + preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); + optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); - preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_TAGS); + preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$ + optionNames.add(COMPILER_TASK_TAGS); - preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_PRIORITIES); + preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$ + optionNames.add(COMPILER_TASK_PRIORITIES); - preferences.setDefault(COMPILER_SOURCE, VERSION_1_3); - optionNames.add(COMPILER_SOURCE); + preferences.setDefault(COMPILER_SOURCE, VERSION_1_3); + optionNames.add(COMPILER_SOURCE); - preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); - optionNames.add(COMPILER_COMPLIANCE); + preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); + optionNames.add(COMPILER_COMPLIANCE); - preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$ - optionNames.add(COMPILER_PB_MAX_PER_UNIT); + preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$ + optionNames.add(COMPILER_PB_MAX_PER_UNIT); - // Builder settings - preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ - optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER); + // Builder settings + preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ + optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER); - preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); - optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH); + preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); + optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH); - preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); - optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE); + preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); + optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE); - preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); - optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER); + preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); + optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER); - // JavaCore settings - preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); - optionNames.add(CORE_JAVA_BUILD_ORDER); + // JavaCore settings + preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); + optionNames.add(CORE_JAVA_BUILD_ORDER); - preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); - optionNames.add(CORE_CIRCULAR_CLASSPATH); + preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); + optionNames.add(CORE_CIRCULAR_CLASSPATH); - preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); - optionNames.add(CORE_INCOMPLETE_CLASSPATH); + preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); + optionNames.add(CORE_INCOMPLETE_CLASSPATH); - preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS); + preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); + optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS); - preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS); + preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); + optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS); - // encoding setting comes from resource plug-in - optionNames.add(CORE_ENCODING); + // encoding setting comes from resource plug-in + optionNames.add(CORE_ENCODING); - // Formatter settings - preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE); + // Formatter settings + preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); + optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE); - preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_CONTROL); + preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT); + optionNames.add(FORMATTER_NEWLINE_CONTROL); - preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); - optionNames.add(FORMATTER_CLEAR_BLANK_LINES); + preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); + optionNames.add(FORMATTER_CLEAR_BLANK_LINES); - preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_ELSE_IF); + preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT); + optionNames.add(FORMATTER_NEWLINE_ELSE_IF); - preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); - optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK); + preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); + optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK); - preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$ - optionNames.add(FORMATTER_LINE_SPLIT); + preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$ + optionNames.add(FORMATTER_LINE_SPLIT); - preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); - optionNames.add(FORMATTER_COMPACT_ASSIGNMENT); + preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); + optionNames.add(FORMATTER_COMPACT_ASSIGNMENT); - preferences.setDefault(FORMATTER_TAB_CHAR, TAB); - optionNames.add(FORMATTER_TAB_CHAR); + preferences.setDefault(FORMATTER_TAB_CHAR, TAB); + optionNames.add(FORMATTER_TAB_CHAR); - preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ - optionNames.add(FORMATTER_TAB_SIZE); + preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ + optionNames.add(FORMATTER_TAB_SIZE); - preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ - optionNames.add(FORMATTER_SPACE_CASTEXPRESSION); + preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ + optionNames.add(FORMATTER_SPACE_CASTEXPRESSION); - // CodeAssist settings - preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_VISIBILITY_CHECK); + // CodeAssist settings + preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$ + optionNames.add(CODEASSIST_VISIBILITY_CHECK); - preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION); + preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$ + optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION); - preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_PREFIXES); + preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_FIELD_PREFIXES); - preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES); + preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES); - preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_PREFIXES); + preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_LOCAL_PREFIXES); - preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_PREFIXES); + preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_ARGUMENT_PREFIXES); - preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_SUFFIXES); + preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_FIELD_SUFFIXES); - preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES); + preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES); - preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_SUFFIXES); + preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_LOCAL_SUFFIXES); - preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES); - } + preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES); +} - /** - * Returns whether the given marker references the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param element the element - * @param marker the marker - * @return true if the marker references the element, false otherwise - * @exception CoreException if the IMarker.getAttribute on the marker fails - */ - public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException { +/** + * Returns whether the given marker references the given Java element. + * Used for markers, which denote a Java element rather than a resource. + * + * @param element the element + * @param marker the marker + * @return true if the marker references the element, false otherwise + * @exception CoreException if the IMarker.getAttribute on the marker fails + */ +public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException { - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } + // only match units or classfiles + if (element instanceof IMember){ + IMember member = (IMember) element; + if (member.isBinary()){ + element = null; //member.getClassFile(); + } else { + element = member.getCompilationUnit(); } - if (element == null) return false; - if (marker == null) return false; + } + if (element == null) return false; + if (marker == null) return false; - String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID); - if (markerHandleId == null) return false; + String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID); + if (markerHandleId == null) return false; - IJavaElement markerElement = JavaCore.create(markerHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. + IJavaElement markerElement = JavaCore.create(markerHandleId); +// while (true){ + if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } + // cycle through enclosing types in case marker is associated with a classfile (15568) +// if (markerElement instanceof IClassFile){ +// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); +// if (enclosingType != null){ +// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile +// continue; // } -// break; // } - return false; - } +// break; +// } + return false; +} - /** - * Returns whether the given marker delta references the given Java element. - * Used for markers deltas, which denote a Java element rather than a resource. - * - * @param element the element - * @param markerDelta the marker delta - * @return true if the marker delta references the element - * @exception CoreException if the IMarkerDelta.getAttribute on the marker delta fails - */ - public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException { +/** + * Returns whether the given marker delta references the given Java element. + * Used for markers deltas, which denote a Java element rather than a resource. + * + * @param element the element + * @param markerDelta the marker delta + * @return true if the marker delta references the element + * @exception CoreException if the IMarkerDelta.getAttribute on the marker delta fails + */ +public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException { - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } + // only match units or classfiles + if (element instanceof IMember){ + IMember member = (IMember) element; + if (member.isBinary()){ + element = null; //member.getClassFile(); + } else { + element = member.getCompilationUnit(); } - if (element == null) return false; - if (markerDelta == null) return false; + } + if (element == null) return false; + if (markerDelta == null) return false; - String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID); - if (markerDeltarHandleId == null) return false; + String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID); + if (markerDeltarHandleId == null) return false; - IJavaElement markerElement = JavaCore.create(markerDeltarHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. + IJavaElement markerElement = JavaCore.create(markerDeltarHandleId); +// while (true){ + if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } + // cycle through enclosing types in case marker is associated with a classfile (15568) +// if (markerElement instanceof IClassFile){ +// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); +// if (enclosingType != null){ +// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile +// continue; // } -// break; // } - return false; - } - - /** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newContainerEntry(-,false). - *

- * @param containerPath the path identifying the container, it must be formed of two - * segments - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -// public static IClasspathEntry newContainerEntry(IPath containerPath) { -// -// return newContainerEntry(containerPath, false); +// break; // } + return false; +} - /** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * @param containerPath the path identifying the container, it must be formed of at least - * one segment (ID+hints) - * @param isExported a boolean indicating whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -// public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) { -// -// if (containerPath == null || containerPath.segmentCount() < 1) { -// Assert.isTrue( -// false, -// "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ -// } -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_CONTAINER, -// containerPath, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// null, // source attachment -// null, // source attachment root -// null, // specific output folder -// isExported); -// } +/** + * Creates and returns a new classpath entry of kind CPE_CONTAINER + * for the given path. The path of the container will be used during resolution so as to map this + * container entry to a set of other classpath entries the container is acting for. + *

+ * A container entry allows to express indirect references to a set of libraries, projects and variable entries, + * which can be interpreted differently for each Java project where it is used. + * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, + * and updated with JavaCore.classpathContainerChanged + *

+ * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the + * extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * A container path must be formed of at least one segment, where:

    + *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered + * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • + *
  • the remaining segments will be passed onto the initializer, and can be used as additional + * hints during the initialization phase.
  • + *
+ *

+ * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: + * + * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); + * + * + * + *

+ * Note that this operation does not attempt to validate classpath containers + * or access the resources at the given paths. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newContainerEntry(-,false). + *

+ * @param containerPath the path identifying the container, it must be formed of two + * segments + * @return a new container classpath entry + * + * @see JavaCore#getClasspathContainer(IPath, IJavaProject) + * @see JavaCore#newContainerEntry(IPath, boolean) + * @since 2.0 + */ +public static IClasspathEntry newContainerEntry(IPath containerPath) { + + return newContainerEntry(containerPath, false); +} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the - * JAR or folder identified by the given absolute path. This specifies that all package fragments - * within the root will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newLibraryEntry(-,-,-,false). - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @return a new library classpath entry - * - * @see #newLibraryEntry(IPath, IPath, IPath, boolean) - */ -// public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath) { +/** + * Creates and returns a new classpath entry of kind CPE_CONTAINER + * for the given path. The path of the container will be used during resolution so as to map this + * container entry to a set of other classpath entries the container is acting for. + *

+ * A container entry allows to express indirect references to a set of libraries, projects and variable entries, + * which can be interpreted differently for each Java project where it is used. + * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, + * and updated with JavaCore.classpathContainerChanged + *

+ * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the + * extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * A container path must be formed of at least one segment, where:

    + *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered + * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • + *
  • the remaining segments will be passed onto the initializer, and can be used as additional + * hints during the initialization phase.
  • + *
+ *

+ * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: + * + * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); + * + * + * + *

+ * Note that this operation does not attempt to validate classpath containers + * or access the resources at the given paths. + *

+ * @param containerPath the path identifying the container, it must be formed of at least + * one segment (ID+hints) + * @param isExported a boolean indicating whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new container classpath entry + * + * @see JavaCore#getClasspathContainer(IPath, IJavaProject) + * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) + * @see JavaCore#newContainerEntry(IPath, boolean) + * @since 2.0 + */ +public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) { + + if (containerPath == null || containerPath.segmentCount() < 1) { + Assert.isTrue( + false, + "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ + } + return new ClasspathEntry( + IPackageFragmentRoot.K_SOURCE, + IClasspathEntry.CPE_CONTAINER, + containerPath, + ClasspathEntry.NO_EXCLUSION_PATTERNS, + null, // source attachment + null, // source attachment root + null, // specific output folder + isExported); +} + +/** + * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the + * JAR or folder identified by the given absolute path. This specifies that all package fragments + * within the root will have children of type IClassFile. + *

+ * A library entry is used to denote a prerequisite JAR or root folder containing binaries. + * The target JAR or folder can either be defined internally to the workspace (absolute path relative + * to the workspace root) or externally to the workspace (absolute path in the file system). + *

+ * e.g. Here are some examples of binary path usage

    + *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • + *
  • "/Project/someLib.jar" - reference to an internal JAR
  • + *
  • "c:/classes/" - reference to an external binary folder
  • + *
+ * Note that this operation does not attempt to validate or access the + * resources at the given paths. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newLibraryEntry(-,-,-,false). + *

+ * + * @param path the absolute path of the binary archive + * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, + * or null if none + * @param sourceAttachmentRootPath the location of the root within the source archive or folder + * or null if this location should be automatically detected. + * @return a new library classpath entry + * + * @see #newLibraryEntry(IPath, IPath, IPath, boolean) + */ +//public static IClasspathEntry newLibraryEntry( +// IPath path, +// IPath sourceAttachmentPath, +// IPath sourceAttachmentRootPath) { // -// return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false); -// } +// return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false); +//} - /** - * Creates and returns a new classpath entry of kind CPE_LIBRARY for the JAR or folder - * identified by the given absolute path. This specifies that all package fragments within the root - * will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new library classpath entry - * @since 2.0 - */ -// public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath, -// boolean isExported) { +/** + * Creates and returns a new classpath entry of kind CPE_LIBRARY for the JAR or folder + * identified by the given absolute path. This specifies that all package fragments within the root + * will have children of type IClassFile. + *

+ * A library entry is used to denote a prerequisite JAR or root folder containing binaries. + * The target JAR or folder can either be defined internally to the workspace (absolute path relative + * to the workspace root) or externally to the workspace (absolute path in the file system). + *

+ * e.g. Here are some examples of binary path usage

    + *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • + *
  • "/Project/someLib.jar" - reference to an internal JAR
  • + *
  • "c:/classes/" - reference to an external binary folder
  • + *
+ * Note that this operation does not attempt to validate or access the + * resources at the given paths. + *

+ * + * @param path the absolute path of the binary archive + * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, + * or null if none + * @param sourceAttachmentRootPath the location of the root within the source archive or folder + * or null if this location should be automatically detected. + * @param isExported indicates whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new library classpath entry + * @since 2.0 + */ +//public static IClasspathEntry newLibraryEntry( +// IPath path, +// IPath sourceAttachmentPath, +// IPath sourceAttachmentRootPath, +// boolean isExported) { // -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ +// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ // -// return new ClasspathEntry( -// IPackageFragmentRoot.K_BINARY, -// IClasspathEntry.CPE_LIBRARY, -// JavaProject.canonicalizedPath(path), -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// sourceAttachmentPath, -// sourceAttachmentRootPath, -// null, // specific output folder -// isExported); -// } +// return new ClasspathEntry( +// IPackageFragmentRoot.K_BINARY, +// IClasspathEntry.CPE_LIBRARY, +// JavaProject.canonicalizedPath(path), +// ClasspathEntry.NO_EXCLUSION_PATTERNS, +// sourceAttachmentPath, +// sourceAttachmentRootPath, +// null, // specific output folder +// isExported); +//} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newProjectEntry(_,false). - *

- * - * @param path the absolute path of the binary archive - * @return a new project classpath entry - * - * @see JavaCore#newProjectEntry(IPath, boolean) - */ -// public static IClasspathEntry newProjectEntry(IPath path) { -// return newProjectEntry(path, false); -// } +/** + * Creates and returns a new non-exported classpath entry of kind CPE_PROJECT + * for the project identified by the given absolute path. + *

+ * A project entry is used to denote a prerequisite project on a classpath. + * The referenced project will be contributed as a whole, either as sources (in the Java Model, it + * contributes all its package fragment roots) or as binaries (when building, it contributes its + * whole output location). + *

+ * A project reference allows to indirect through another project, independently from its internal layout. + *

+ * The prerequisite project is referred to using an absolute path relative to the workspace root. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newProjectEntry(_,false). + *

+ * + * @param path the absolute path of the binary archive + * @return a new project classpath entry + * + * @see JavaCore#newProjectEntry(IPath, boolean) + */ +public static IClasspathEntry newProjectEntry(IPath path) { + return newProjectEntry(path, false); +} - /** - * Creates and returns a new classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * - * @param path the absolute path of the prerequisite project - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new project classpath entry - * @since 2.0 - */ -// public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { -// -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_PROJECT, -// path, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// null, // source attachment -// null, // source attachment root -// null, // specific output folder -// isExported); -// } +/** + * Creates and returns a new classpath entry of kind CPE_PROJECT + * for the project identified by the given absolute path. + *

+ * A project entry is used to denote a prerequisite project on a classpath. + * The referenced project will be contributed as a whole, either as sources (in the Java Model, it + * contributes all its package fragment roots) or as binaries (when building, it contributes its + * whole output location). + *

+ * A project reference allows to indirect through another project, independently from its internal layout. + *

+ * The prerequisite project is referred to using an absolute path relative to the workspace root. + *

+ * + * @param path the absolute path of the prerequisite project + * @param isExported indicates whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new project classpath entry + * @since 2.0 + */ +public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { + + if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ + + return new ClasspathEntry( + IPackageFragmentRoot.K_SOURCE, + IClasspathEntry.CPE_PROJECT, + path, + ClasspathEntry.NO_EXCLUSION_PATTERNS, + null, // source attachment + null, // source attachment root + null, // specific output folder + isExported); +} - /** - * Returns a new empty region. - * - * @return a new empty region - */ - public static IRegion newRegion() { - return new Region(); - } +/** + * Returns a new empty region. + * + * @return a new empty region + */ +public static IRegion newRegion() { + return new Region(); +} - /** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path. This specifies that all package fragments - * within the root will have children of type ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path. To selectively exclude - * some of these source files, use the factory method - * JavaCore.newSourceEntry(IPath,IPath[]) instead. - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @return a new source classpath entry with not exclusion patterns - * - * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[]) - */ -// public static IClasspathEntry newSourceEntry(IPath path) { -// -// return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/); -// } +/** + * Creates and returns a new classpath entry of kind CPE_SOURCE + * for the project's source folder identified by the given absolute + * workspace-relative path. This specifies that all package fragments + * within the root will have children of type ICompilationUnit. + *

+ * The source folder is referred to using an absolute path relative to the + * workspace root, e.g. /Project/src. A project's source + * folders are located with that project. That is, a source classpath + * entry specifying the path /P1/src is only usable for + * project P1. + *

+ *

+ * The source classpath entry created by this method includes all source + * files below the given workspace-relative path. To selectively exclude + * some of these source files, use the factory method + * JavaCore.newSourceEntry(IPath,IPath[]) instead. + *

+ *

+ * Note that all sources/binaries inside a project are contributed as a whole through + * a project entry (see JavaCore.newProjectEntry). Particular + * source entries cannot be selectively exported. + *

+ * + * @param path the absolute workspace-relative path of a source folder + * @return a new source classpath entry with not exclusion patterns + * + * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[]) + */ +public static IClasspathEntry newSourceEntry(IPath path) { + + return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/); +} - /** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns. This specifies that all package - * fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * - * @since 2.1 - */ -// public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { -// -// return newSourceEntry(path, exclusionPatterns, null /*output location*/); -// } +/** + * Creates and returns a new classpath entry of kind CPE_SOURCE + * for the project's source folder identified by the given absolute + * workspace-relative path but excluding all source files with paths + * matching any of the given patterns. This specifies that all package + * fragments within the root will have children of type + * ICompilationUnit. + *

+ * The source folder is referred to using an absolute path relative to the + * workspace root, e.g. /Project/src. A project's source + * folders are located with that project. That is, a source classpath + * entry specifying the path /P1/src is only usable for + * project P1. + *

+ *

+ * The source classpath entry created by this method includes all source + * files below the given workspace-relative path except for those matched + * by one (or more) of the given exclusion patterns. Each exclusion pattern + * is represented by a relative path, which is interpreted as relative to + * the source folder. For example, if the source folder path is + * /Project/src and the exclusion pattern is + * com/xyz/tests/**, then source files + * like /Project/src/com/xyz/Foo.java + * and /Project/src/com/xyz/utils/Bar.java would be included, + * whereas /Project/src/com/xyz/tests/T1.java + * and /Project/src/com/xyz/tests/quick/T2.java would be + * excluded. Exclusion patterns can contain can contain '**', '*' or '?' + * wildcards; see IClasspathEntry.getExclusionPatterns + * for the full description of the syntax and semantics of exclusion + * patterns. + *

+ * If the empty list of exclusion patterns is specified, the source folder + * will automatically include all resources located inside the source + * folder. In that case, the result is entirely equivalent to using the + * factory method JavaCore.newSourceEntry(IPath). + *

+ *

+ * Note that all sources/binaries inside a project are contributed as a whole through + * a project entry (see JavaCore.newProjectEntry). Particular + * source entries cannot be selectively exported. + *

+ * + * @param path the absolute workspace-relative path of a source folder + * @param exclusionPatterns the possibly empty list of exclusion patterns + * represented as relative paths + * @return a new source classpath entry with the given exclusion patterns + * @see #newSourceEntry(org.eclipse.core.runtime.IPath) + * @see IClasspathEntry#getExclusionPatterns + * + * @since 2.1 + */ +public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { - /** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns, and associated with a specific output location - * (that is, ".class" files are not going to the project default output location). - * All package fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Additionally, a source entry can be associated with a specific output location. - * By doing so, the Java builder will ensure that the generated ".class" files will - * be issued inside this output location, as opposed to be generated into the - * project default output location (when output location is null). - * Note that multiple source entries may target the same output location. - * The output location is referred to using an absolute path relative to the - * workspace root, e.g. "/Project/bin", it must be located inside - * the same project as the source folder. - *

- *

- * Also note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @param outputLocation the specific output location for this source entry (null if using project default ouput location) - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * @see IClasspathEntry#getOutputLocation() - * - * @since 2.1 - */ -// public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) { -// -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ -// if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_SOURCE, -// path, -// exclusionPatterns, -// null, // source attachment -// null, // source attachment root -// specificOutputLocation, // custom output location -// false); -// } + return newSourceEntry(path, exclusionPatterns, null /*output location*/); +} + +/** + * Creates and returns a new classpath entry of kind CPE_SOURCE + * for the project's source folder identified by the given absolute + * workspace-relative path but excluding all source files with paths + * matching any of the given patterns, and associated with a specific output location + * (that is, ".class" files are not going to the project default output location). + * All package fragments within the root will have children of type + * ICompilationUnit. + *

+ * The source folder is referred to using an absolute path relative to the + * workspace root, e.g. /Project/src. A project's source + * folders are located with that project. That is, a source classpath + * entry specifying the path /P1/src is only usable for + * project P1. + *

+ *

+ * The source classpath entry created by this method includes all source + * files below the given workspace-relative path except for those matched + * by one (or more) of the given exclusion patterns. Each exclusion pattern + * is represented by a relative path, which is interpreted as relative to + * the source folder. For example, if the source folder path is + * /Project/src and the exclusion pattern is + * com/xyz/tests/**, then source files + * like /Project/src/com/xyz/Foo.java + * and /Project/src/com/xyz/utils/Bar.java would be included, + * whereas /Project/src/com/xyz/tests/T1.java + * and /Project/src/com/xyz/tests/quick/T2.java would be + * excluded. Exclusion patterns can contain can contain '**', '*' or '?' + * wildcards; see IClasspathEntry.getExclusionPatterns + * for the full description of the syntax and semantics of exclusion + * patterns. + *

+ * If the empty list of exclusion patterns is specified, the source folder + * will automatically include all resources located inside the source + * folder. In that case, the result is entirely equivalent to using the + * factory method JavaCore.newSourceEntry(IPath). + *

+ *

+ * Additionally, a source entry can be associated with a specific output location. + * By doing so, the Java builder will ensure that the generated ".class" files will + * be issued inside this output location, as opposed to be generated into the + * project default output location (when output location is null). + * Note that multiple source entries may target the same output location. + * The output location is referred to using an absolute path relative to the + * workspace root, e.g. "/Project/bin", it must be located inside + * the same project as the source folder. + *

+ *

+ * Also note that all sources/binaries inside a project are contributed as a whole through + * a project entry (see JavaCore.newProjectEntry). Particular + * source entries cannot be selectively exported. + *

+ * + * @param path the absolute workspace-relative path of a source folder + * @param exclusionPatterns the possibly empty list of exclusion patterns + * represented as relative paths + * @param outputLocation the specific output location for this source entry (null if using project default ouput location) + * @return a new source classpath entry with the given exclusion patterns + * @see #newSourceEntry(org.eclipse.core.runtime.IPath) + * @see IClasspathEntry#getExclusionPatterns + * @see IClasspathEntry#getOutputLocation() + * + * @since 2.1 + */ +public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) { + + if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ + if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ + + return new ClasspathEntry( + IPackageFragmentRoot.K_SOURCE, + IClasspathEntry.CPE_SOURCE, + path, + exclusionPatterns, + null, // source attachment + null, // source attachment root + specificOutputLocation, // custom output location + false); +} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newVariableEntry(-,-,-,false). - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @return a new library classpath entry - * - * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean) - */ -// public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath sourceAttachmentRootPath) { +/** + * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE + * for the given path. The first segment of the path is the name of a classpath variable. + * The trailing segments of the path will be appended to resolved variable path. + *

+ * A variable entry allows to express indirect references on a classpath to other projects or libraries, + * depending on what the classpath variable is referring. + *

+ * It is possible to register an automatic initializer (ClasspathVariableInitializer), + * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * After resolution, a classpath variable entry may either correspond to a project or a library entry. + *

+ * e.g. Here are some examples of variable path usage

    + *
  • "JDTCORE" where variable JDTCORE is + * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • + *
  • "JDTCORE" where variable JDTCORE is + * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • + *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS + * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • + *
+ * Note that this operation does not attempt to validate classpath variables + * or access the resources at the given paths. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newVariableEntry(-,-,-,false). + *

+ * + * @param variablePath the path of the binary archive; first segment is the + * name of a classpath variable + * @param variableSourceAttachmentPath the path of the corresponding source archive, + * or null if none; if present, the first segment is the + * name of a classpath variable (not necessarily the same variable + * as the one that begins variablePath) + * @param sourceAttachmentRootPath the location of the root within the source archive + * or null if archivePath is also null + * @return a new library classpath entry + * + * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean) + */ +//public static IClasspathEntry newVariableEntry( +// IPath variablePath, +// IPath variableSourceAttachmentPath, +// IPath sourceAttachmentRootPath) { // -// return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false); -// } +// return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false); +//} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new variable classpath entry - * @since 2.0 - */ -// public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath variableSourceAttachmentRootPath, -// boolean isExported) { +/** + * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE + * for the given path. The first segment of the path is the name of a classpath variable. + * The trailing segments of the path will be appended to resolved variable path. + *

+ * A variable entry allows to express indirect references on a classpath to other projects or libraries, + * depending on what the classpath variable is referring. + *

+ * It is possible to register an automatic initializer (ClasspathVariableInitializer), + * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * After resolution, a classpath variable entry may either correspond to a project or a library entry. + *

+ * e.g. Here are some examples of variable path usage

    + *
  • "JDTCORE" where variable JDTCORE is + * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • + *
  • "JDTCORE" where variable JDTCORE is + * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • + *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS + * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • + *
+ * Note that this operation does not attempt to validate classpath variables + * or access the resources at the given paths. + *

+ * + * @param variablePath the path of the binary archive; first segment is the + * name of a classpath variable + * @param variableSourceAttachmentPath the path of the corresponding source archive, + * or null if none; if present, the first segment is the + * name of a classpath variable (not necessarily the same variable + * as the one that begins variablePath) + * @param sourceAttachmentRootPath the location of the root within the source archive + * or null if archivePath is also null + * @param isExported indicates whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new variable classpath entry + * @since 2.0 + */ +//public static IClasspathEntry newVariableEntry( +// IPath variablePath, +// IPath variableSourceAttachmentPath, +// IPath variableSourceAttachmentRootPath, +// boolean isExported) { // -// if (variablePath == null || variablePath.segmentCount() < 1) { -// Assert.isTrue( -// false, -// "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ -// } -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_VARIABLE, -// variablePath, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// variableSourceAttachmentPath, // source attachment -// variableSourceAttachmentRootPath, // source attachment root -// null, // specific output folder -// isExported); +// if (variablePath == null || variablePath.segmentCount() < 1) { +// Assert.isTrue( +// false, +// "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ // } +// +// return new ClasspathEntry( +// IPackageFragmentRoot.K_SOURCE, +// IClasspathEntry.CPE_VARIABLE, +// variablePath, +// ClasspathEntry.NO_EXCLUSION_PATTERNS, +// variableSourceAttachmentPath, // source attachment +// variableSourceAttachmentRootPath, // source attachment root +// null, // specific output folder +// isExported); +//} - /** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @see #setClasspathVariable - * - * @deprecated - use version with extra IProgressMonitor - */ -// public static void removeClasspathVariable(String variableName) { -// removeClasspathVariable(variableName, null); -// } +/** + * Removed the given classpath variable. Does nothing if no value was + * set for this classpath variable. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @param variableName the name of the classpath variable + * @see #setClasspathVariable + * + * @deprecated - use version with extra IProgressMonitor + */ +//public static void removeClasspathVariable(String variableName) { +// removeClasspathVariable(variableName, null); +//} - /** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param monitor the progress monitor to report progress - * @see #setClasspathVariable - */ -// public static void removeClasspathVariable( -// String variableName, -// IProgressMonitor monitor) { +/** + * Removed the given classpath variable. Does nothing if no value was + * set for this classpath variable. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @param variableName the name of the classpath variable + * @param monitor the progress monitor to report progress + * @see #setClasspathVariable + */ +//public static void removeClasspathVariable( +// String variableName, +// IProgressMonitor monitor) { // -// try { -// updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor); -// } catch (JavaModelException e) { -// } +// try { +// updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor); +// } catch (JavaModelException e) { // } +//} - /** - * Removes the given element changed listener. - * Has no affect if an identical listener is not registered. - * - * @param listener the listener - */ - public static void removeElementChangedListener(IElementChangedListener listener) { - JavaModelManager.getJavaModelManager().removeElementChangedListener(listener); - } - /** - * Runs the given action as an atomic Java model operation. - *

- * After running a method that modifies Java elements, - * registered listeners receive after-the-fact notification of - * what just transpired, in the form of a element changed event. - * This method allows clients to call a number of - * methods that modify java elements and only have element - * changed event notifications reported at the end of the entire - * batch. - *

- *

- * If this method is called outside the dynamic scope of another such - * call, this method runs the action and then reports a single - * element changed event describing the net effect of all changes - * done to java elements by the action. - *

- *

- * If this method is called in the dynamic scope of another such - * call, this method simply runs the action. - *

- * - * @param action the action to perform - * @param monitor a progress monitor, or null if progress - * reporting and cancellation are not desired - * @exception CoreException if the operation failed. - * @since 2.1 - */ - public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (workspace.isTreeLocked()) { - new BatchOperation(action).run(monitor); - } else { - // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode - workspace.run(new BatchOperation(action), monitor); - } - } - /** - * Bind a container reference path to some actual containers (IClasspathContainer). - * This API must be invoked whenever changes in container need to be reflected onto the JavaModel. - * Containers can have distinct values in different projects, therefore this API considers a - * set of projects with their respective containers. - *

- * containerPath is the path under which these values can be referenced through - * container classpath entries (IClasspathEntry#CPE_CONTAINER). A container path - * is formed by a first ID segment followed with extra segments, which can be used as additional hints - * for the resolution. The container ID is used to identify a ClasspathContainerInitializer - * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that each individual container value passed in argument - * (respectiveContainers) must answer the exact same path when requested - * IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be - * delegated to a ClasspathContainerInitializer, which can be activated through the extension - * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * In reaction to changing container values, the JavaModel will be updated to reflect the new - * state of the updated container. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * Note: setting a container to null will cause it to be lazily resolved again whenever - * its value is required. In particular, this will cause a registered initializer to be invoked - * again. - *

- * @param containerPath - the name of the container reference, which is being updated - * @param affectedProjects - the set of projects for which this container is being bound - * @param respectiveContainers - the set of respective containers for the affected projects - * @param monitor a monitor to report progress - * - * @see ClasspathContainerInitializer - * @see #getClasspathContainer(IPath, IJavaProject) - * @see IClasspathContainer - * @since 2.0 - */ -// public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { +/** + * Removes the given element changed listener. + * Has no affect if an identical listener is not registered. + * + * @param listener the listener + */ +public static void removeElementChangedListener(IElementChangedListener listener) { + JavaModelManager.getJavaModelManager().removeElementChangedListener(listener); +} + +/** + * Bind a container reference path to some actual containers (IClasspathContainer). + * This API must be invoked whenever changes in container need to be reflected onto the JavaModel. + * Containers can have distinct values in different projects, therefore this API considers a + * set of projects with their respective containers. + *

+ * containerPath is the path under which these values can be referenced through + * container classpath entries (IClasspathEntry#CPE_CONTAINER). A container path + * is formed by a first ID segment followed with extra segments, which can be used as additional hints + * for the resolution. The container ID is used to identify a ClasspathContainerInitializer + * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * There is no assumption that each individual container value passed in argument + * (respectiveContainers) must answer the exact same path when requested + * IClasspathContainer#getPath. + * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be + * delegated to a ClasspathContainerInitializer, which can be activated through the extension + * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). + *

+ * In reaction to changing container values, the JavaModel will be updated to reflect the new + * state of the updated container. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath container values are persisted locally to the workspace, but + * are not preserved from a session to another. It is thus highly recommended to register a + * ClasspathContainerInitializer for each referenced container + * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). + *

+ * Note: setting a container to null will cause it to be lazily resolved again whenever + * its value is required. In particular, this will cause a registered initializer to be invoked + * again. + *

+ * @param containerPath - the name of the container reference, which is being updated + * @param affectedProjects - the set of projects for which this container is being bound + * @param respectiveContainers - the set of respective containers for the affected projects + * @param monitor a monitor to report progress + * + * @see ClasspathContainerInitializer + * @see #getClasspathContainer(IPath, IJavaProject) + * @see IClasspathContainer + * @since 2.0 + */ +//public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { // -// if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ +// if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer SET - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$ -// + (Util.toString(affectedProjects, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } -// })) -// + "} with values: " //$NON-NLS-1$ -// + (Util.toString(respectiveContainers, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); } -// })) -// ); -// } +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPContainer SET - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$ +// + (Util.toString(affectedProjects, +// new Util.Displayable(){ +// public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } +// })) +// + "} with values: " //$NON-NLS-1$ +// + (Util.toString(respectiveContainers, +// new Util.Displayable(){ +// public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); } +// })) +// ); +// } // -// final int projectLength = affectedProjects.length; -// final IJavaProject[] modifiedProjects; -// System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength); -// final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][]; +// final int projectLength = affectedProjects.length; +// final IJavaProject[] modifiedProjects; +// System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength); +// final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][]; // -// // filter out unmodified project containers -// int remaining = 0; -// for (int i = 0; i < projectLength; i++){ +// // filter out unmodified project containers +// int remaining = 0; +// for (int i = 0; i < projectLength; i++){ // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// IJavaProject affectedProject = affectedProjects[i]; -// IClasspathContainer newContainer = respectiveContainers[i]; -// if (newContainer == null) newContainer = JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent infinite loop -// boolean found = false; -// if (JavaProject.hasJavaNature(affectedProject.getProject())){ -// IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath(); -// for (int j = 0, cpLength = rawClasspath.length; j - * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param path the path - * @see #getClasspathVariable - * - * @deprecated - use API with IProgressMonitor - */ -// public static void setClasspathVariable(String variableName, IPath path) -// throws JavaModelException { +/** + * Sets the value of the given classpath variable. + * The path must have at least one segment. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @param variableName the name of the classpath variable + * @param path the path + * @see #getClasspathVariable + * + * @deprecated - use API with IProgressMonitor + */ +//public static void setClasspathVariable(String variableName, IPath path) +// throws JavaModelException { // -// setClasspathVariable(variableName, path, null); -// } +// setClasspathVariable(variableName, path, null); +//} - /** - * Sets the value of the given classpath variable. - * The path must not be null. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableName the name of the classpath variable - * @param path the path - * @param monitor a monitor to report progress - * @see #getClasspathVariable - */ -// public static void setClasspathVariable( -// String variableName, -// IPath path, -// IProgressMonitor monitor) -// throws JavaModelException { +/** + * Sets the value of the given classpath variable. + * The path must not be null. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * Updating a variable with the same value has no effect. + * + * @param variableName the name of the classpath variable + * @param path the path + * @param monitor a monitor to report progress + * @see #getClasspathVariable + */ +//public static void setClasspathVariable( +// String variableName, +// IPath path, +// IProgressMonitor monitor) +// throws JavaModelException { // -// if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ -// setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); -// } +// if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ +// setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); +//} - /** - * Sets the values of all the given classpath variables at once. - * Null paths can be used to request corresponding variable removal. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableNames an array of names for the updated classpath variables - * @param paths an array of path updates for the modified classpath variables (null - * meaning that the corresponding value will be removed - * @param monitor a monitor to report progress - * @see #getClasspathVariable - * @since 2.0 - */ -// public static void setClasspathVariables( -// String[] variableNames, -// IPath[] paths, -// IProgressMonitor monitor) -// throws JavaModelException { +/** + * Sets the values of all the given classpath variables at once. + * Null paths can be used to request corresponding variable removal. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * Updating a variable with the same value has no effect. + * + * @param variableNames an array of names for the updated classpath variables + * @param paths an array of path updates for the modified classpath variables (null + * meaning that the corresponding value will be removed + * @param monitor a monitor to report progress + * @see #getClasspathVariable + * @since 2.0 + */ +//public static void setClasspathVariables( +// String[] variableNames, +// IPath[] paths, +// IProgressMonitor monitor) +// throws JavaModelException { // -// if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ -// //TODO: should check that null cannot be used as variable paths -// updateVariableValues(variableNames, paths, monitor); -// } - - /* (non-Javadoc) - * Method declared on IExecutableExtension. - * Record any necessary initialization data from the plugin. - */ - public void setInitializationData( - IConfigurationElement cfig, - String propertyName, - Object data) - throws CoreException { - } +// if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ +// //TODO: should check that null cannot be used as variable paths +// updateVariableValues(variableNames, paths, monitor); +//} + +/* (non-Javadoc) + * Method declared on IExecutableExtension. + * Record any necessary initialization data from the plugin. + */ +public void setInitializationData( + IConfigurationElement cfig, + String propertyName, + Object data) + throws CoreException { +} - /** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param newOptions the new options (key type: String; value type: String), - * or null to reset all options to their default values - * @see JavaCore#getDefaultOptions - */ - public static void setOptions(Hashtable newOptions) { +/** + * Sets the current table of options. All and only the options explicitly included in the given table + * are remembered; all previous option settings are forgotten, including ones not explicitly + * mentioned. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param newOptions the new options (key type: String; value type: String), + * or null to reset all options to their default values + * @see JavaCore#getDefaultOptions + */ +public static void setOptions(Hashtable newOptions) { - // see #initializeDefaultPluginPreferences() for changing default settings - Preferences preferences = getPlugin().getPluginPreferences(); + // see #initializeDefaultPluginPreferences() for changing default settings + Preferences preferences = getPlugin().getPluginPreferences(); - if (newOptions == null){ - newOptions = JavaCore.getDefaultOptions(); - } - Enumeration keys = newOptions.keys(); - while (keys.hasMoreElements()){ - String key = (String)keys.nextElement(); - if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option - if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs - String value = (String)newOptions.get(key); - preferences.setValue(key, value); - } - - // persist options - getPlugin().savePluginPreferences(); + if (newOptions == null){ + newOptions = JavaCore.getDefaultOptions(); } - - /** - * Shutdown the JavaCore plug-in. - *

- * De-registers the JavaModelManager as a resource changed listener and save participant. - *

- * @see org.eclipse.core.runtime.Plugin#shutdown() - */ - public void shutdown() { - - savePluginPreferences(); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor); - workspace.removeSaveParticipant(this); - - ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); + Enumeration keys = newOptions.keys(); + while (keys.hasMoreElements()){ + String key = (String)keys.nextElement(); + if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option + if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs + String value = (String)newOptions.get(key); + preferences.setValue(key, value); } + + // persist options + getPlugin().savePluginPreferences(); +} + +/** + * Shutdown the JavaCore plug-in. + *

+ * De-registers the JavaModelManager as a resource changed listener and save participant. + *

+ * @see org.eclipse.core.runtime.Plugin#shutdown() + */ +// moved to PHPeclipsePlugin#shutdown() +//public void shutdown() { +// +// //savePluginPreferences(); +// getPlugin().savePluginPreferences(); +// IWorkspace workspace = ResourcesPlugin.getWorkspace(); +// workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor); +// workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault()); +// +// ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); +//} - /** - * Initiate the background indexing process. - * This should be deferred after the plugin activation. - */ -// private void startIndexing() { +/** + * Initiate the background indexing process. + * This should be deferred after the plugin activation. + */ +//private void startIndexing() { // -// JavaModelManager.getJavaModelManager().getIndexManager().reset(); -// } +// JavaModelManager.getJavaModelManager().getIndexManager().reset(); +//} - /** - * Startup of the JavaCore plug-in. - *

- * Registers the JavaModelManager as a resource changed listener and save participant. - * Starts the background indexing, and restore saved classpath variable values. - *

- * @see org.eclipse.core.runtime.Plugin#startup() - */ - public void startup() { - - JavaModelManager manager = JavaModelManager.getJavaModelManager(); - try { - manager.configurePluginDebugOptions(); - - // request state folder creation (workaround 19885) - JavaCore.getPlugin().getStateLocation(); - - // retrieve variable values - JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); -// TODO khartlage temp-del -// manager.loadVariablesAndContainers(); - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener( - manager.deltaProcessor, - IResourceChangeEvent.PRE_AUTO_BUILD - | IResourceChangeEvent.POST_AUTO_BUILD - | IResourceChangeEvent.POST_CHANGE - | IResourceChangeEvent.PRE_DELETE - | IResourceChangeEvent.PRE_CLOSE); - -// startIndexing(); - workspace.addSaveParticipant(this, manager); - - } catch (CoreException e) { - } catch (RuntimeException e) { - manager.shutdown(); - throw e; - } - } +/** + * Startup of the JavaCore plug-in. + *

+ * Registers the JavaModelManager as a resource changed listener and save participant. + * Starts the background indexing, and restore saved classpath variable values. + *

+ * @see org.eclipse.core.runtime.Plugin#startup() + */ +// moved to PHPeclipsePlugin#startup() +//public void startup() { +// +// JavaModelManager manager = JavaModelManager.getJavaModelManager(); +// try { +// manager.configurePluginDebugOptions(); +// +// // request state folder creation (workaround 19885) +// JavaCore.getPlugin().getStateLocation(); +// +// // retrieve variable values +// JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); +//// TODO khartlage temp-del +//// manager.loadVariablesAndContainers(); +// +// IWorkspace workspace = ResourcesPlugin.getWorkspace(); +// workspace.addResourceChangeListener( +// manager.deltaProcessor, +// IResourceChangeEvent.PRE_AUTO_BUILD +// | IResourceChangeEvent.POST_AUTO_BUILD +// | IResourceChangeEvent.POST_CHANGE +// | IResourceChangeEvent.PRE_DELETE +// | IResourceChangeEvent.PRE_CLOSE); +// +//// startIndexing(); +// workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager); +// +// } catch (CoreException e) { +// } catch (RuntimeException e) { +// manager.shutdown(); +// throw e; +// } +//} - /** - * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once. - */ -// private static void updateVariableValues( -// String[] variableNames, -// IPath[] variablePaths, -// IProgressMonitor monitor) throws JavaModelException { + +/** + * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once. + */ +//private static void updateVariableValues( +// String[] variableNames, +// IPath[] variablePaths, +// IProgressMonitor monitor) throws JavaModelException { // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - setting variables: {" + Util.toString(variableNames) //$NON-NLS-1$ -// + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$ -// } +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable SET - setting variables: {" + Util.toString(variableNames) //$NON-NLS-1$ +// + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$ +// } // -// int varLength = variableNames.length; +// int varLength = variableNames.length; // -// // gather classpath information for updating -// final HashMap affectedProjects = new HashMap(5); -// JavaModelManager manager = JavaModelManager.getJavaModelManager(); -// IJavaModel model = manager.getJavaModel(); +// // gather classpath information for updating +// final HashMap affectedProjects = new HashMap(5); +// JavaModelManager manager = JavaModelManager.getJavaModelManager(); +// IJavaModel model = manager.getJavaModel(); // -// // filter out unmodified variables -// int discardCount = 0; -// for (int i = 0; i < varLength; i++){ -// String variableName = variableNames[i]; -// IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value -// if (oldPath == JavaModelManager.VariableInitializationInProgress){ -// IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName); -// if (previousPath != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value +// // filter out unmodified variables +// int discardCount = 0; +// for (int i = 0; i < varLength; i++){ +// String variableName = variableNames[i]; +// IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value +// if (oldPath == JavaModelManager.VariableInitializationInProgress){ +// IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName); +// if (previousPath != null){ +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$ // } -// oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP -// } -// if (oldPath != null && oldPath.equals(variablePaths[i])){ -// variableNames[i] = null; -// discardCount++; +// JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value // } +// oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP // } -// if (discardCount > 0){ -// if (discardCount == varLength) return; -// int changedLength = varLength - discardCount; -// String[] changedVariableNames = new String[changedLength]; -// IPath[] changedVariablePaths = new IPath[changedLength]; -// for (int i = 0, index = 0; i < varLength; i++){ -// if (variableNames[i] != null){ -// changedVariableNames[index] = variableNames[i]; -// changedVariablePaths[index] = variablePaths[i]; -// index++; -// } +// if (oldPath != null && oldPath.equals(variablePaths[i])){ +// variableNames[i] = null; +// discardCount++; +// } +// } +// if (discardCount > 0){ +// if (discardCount == varLength) return; +// int changedLength = varLength - discardCount; +// String[] changedVariableNames = new String[changedLength]; +// IPath[] changedVariablePaths = new IPath[changedLength]; +// for (int i = 0, index = 0; i < varLength; i++){ +// if (variableNames[i] != null){ +// changedVariableNames[index] = variableNames[i]; +// changedVariablePaths[index] = variablePaths[i]; +// index++; // } -// variableNames = changedVariableNames; -// variablePaths = changedVariablePaths; -// varLength = changedLength; // } +// variableNames = changedVariableNames; +// variablePaths = changedVariablePaths; +// varLength = changedLength; +// } // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// if (model != null) { -// IJavaProject[] projects = model.getJavaProjects(); -// nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){ -// IJavaProject project = projects[i]; +// if (model != null) { +// IJavaProject[] projects = model.getJavaProjects(); +// nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){ +// IJavaProject project = projects[i]; // -// // check to see if any of the modified variables is present on the classpath -// IClasspathEntry[] classpath = project.getRawClasspath(); -// for (int j = 0, cpLength = classpath.length; j < cpLength; j++){ +// // check to see if any of the modified variables is present on the classpath +// IClasspathEntry[] classpath = project.getRawClasspath(); +// for (int j = 0, cpLength = classpath.length; j < cpLength; j++){ // -// IClasspathEntry entry = classpath[j]; -// for (int k = 0; k < varLength; k++){ +// IClasspathEntry entry = classpath[j]; +// for (int k = 0; k < varLength; k++){ // -// String variableName = variableNames[k]; -// if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ +// String variableName = variableNames[k]; +// if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ // -// if (variableName.equals(entry.getPath().segment(0))){ -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// IPath sourcePath, sourceRootPath; -// if (((sourcePath = entry.getSourceAttachmentPath()) != null && variableName.equals(sourcePath.segment(0))) -// || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null && variableName.equals(sourceRootPath.segment(0)))) { +// if (variableName.equals(entry.getPath().segment(0))){ +// affectedProjects.put(project, project.getResolvedClasspath(true)); +// continue nextProject; +// } +// IPath sourcePath, sourceRootPath; +// if (((sourcePath = entry.getSourceAttachmentPath()) != null && variableName.equals(sourcePath.segment(0))) +// || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null && variableName.equals(sourceRootPath.segment(0)))) { // -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// } -// } +// affectedProjects.put(project, project.getResolvedClasspath(true)); +// continue nextProject; +// } +// } // } // } // } -// // update variables -// for (int i = 0; i < varLength; i++){ -// JavaModelManager.variablePut(variableNames[i], variablePaths[i]); -// } -// final String[] dbgVariableNames = variableNames; +// } +// // update variables +// for (int i = 0; i < varLength; i++){ +// JavaModelManager.variablePut(variableNames[i], variablePaths[i]); +// } +// final String[] dbgVariableNames = variableNames; // -// // update affected project classpaths -// if (!affectedProjects.isEmpty()) { -// try { -// JavaCore.run( -// new IWorkspaceRunnable() { -// public void run(IProgressMonitor monitor) throws CoreException { -// // propagate classpath change -// Iterator projectsToUpdate = affectedProjects.keySet().iterator(); -// while (projectsToUpdate.hasNext()) { +// // update affected project classpaths +// if (!affectedProjects.isEmpty()) { +// try { +// JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run( +// new IWorkspaceRunnable() { +// public void run(IProgressMonitor monitor) throws CoreException { +// // propagate classpath change +// Iterator projectsToUpdate = affectedProjects.keySet().iterator(); +// while (projectsToUpdate.hasNext()) { // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// JavaProject project = (JavaProject) projectsToUpdate.next(); +// JavaProject project = (JavaProject) projectsToUpdate.next(); // -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// project -// .setRawClasspath( -// project.getRawClasspath(), -// SetClasspathOperation.ReuseOutputLocation, -// null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717) -// !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources -// (IClasspathEntry[]) affectedProjects.get(project), -// false, // updating - no validation -// false); // updating - no need to save +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable SET - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$ // } +// +// project +// .setRawClasspath( +// project.getRawClasspath(), +// SetClasspathOperation.ReuseOutputLocation, +// null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717) +// !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources +// (IClasspathEntry[]) affectedProjects.get(project), +// false, // updating - no validation +// false); // updating - no need to save // } -// }, -// monitor); -// } catch (CoreException e) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$ -// e.printStackTrace(); -// } -// if (e instanceof JavaModelException) { -// throw (JavaModelException)e; -// } else { -// throw new JavaModelException(e); -// } +// } +// }, +// monitor); +// } catch (CoreException e) { +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$ +// e.printStackTrace(); +// } +// if (e instanceof JavaModelException) { +// throw (JavaModelException)e; +// } else { +// throw new JavaModelException(e); // } // } // } +//} } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java index 9f8a201..e008a21 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java @@ -10,12 +10,11 @@ * IBM Corporation - added #createScanner allowing to make comment check stricter ******************************************************************************/ package net.sourceforge.phpdt.core; - + import java.util.Map; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.formatter.CodeFormatter; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.runtime.Plugin; @@ -40,7 +39,7 @@ public class ToolFactory { */ public static ICodeFormatter createCodeFormatter(){ - Plugin jdtCorePlugin = PHPCore.getPlugin(); + Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; // IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.FORMATTER_EXTPOINT_ID); @@ -79,7 +78,7 @@ public class ToolFactory { */ public static ICodeFormatter createDefaultCodeFormatter(Map options){ - if (options == null) options = PHPCore.getOptions(); + if (options == null) options = JavaCore.getOptions(); return new CodeFormatter(options); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java index 62feaeb..7d6e6b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java @@ -43,7 +43,7 @@ public interface ITerminalSymbols { final static int TokenNameEOF = 0; final static int TokenNameERROR = 1; - final static int TokenNameStopPHP = 2; + final static int TokenNameINLINE_HTML = 2; final static int TokenNameREMAINDER = 30; final static int TokenNameNOT = 31; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 2a0e2c1..820b0c7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -23,7 +23,7 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclarati import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference; import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration; -import net.sourceforge.phpeclipse.phpeditor.PHPString; + import org.eclipse.core.resources.IFile; public class Parser //extends PHPParserSuperclass implements ITerminalSymbols, CompilerModifiers, ParserBasicInformation { @@ -1111,7 +1111,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after do-while statement."); } getNextToken(); @@ -1151,7 +1151,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'continue', 'break' or 'return'."); } getNextToken(); @@ -1163,12 +1163,15 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'echo' statement."); } getNextToken(); } return; + } else if (token == TokenNameINLINE_HTML) { + getNextToken(); + return; // } else if (token == TokenNameprint) { // getNextToken(); // expression(); @@ -1187,7 +1190,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'global' statement."); } getNextToken(); @@ -1199,7 +1202,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'static' statement."); } getNextToken(); @@ -1221,59 +1224,12 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'unset' statement."); } getNextToken(); } return; - // } else if (token == TokenNameexit || token == TokenNamedie) { - // getNextToken(); - // if (token != TokenNameSEMICOLON) { - // exitStatus(); - // } - // if (token == TokenNameSEMICOLON) { - // getNextToken(); - // } else { - // if (token != TokenNameStopPHP) { - // throwSyntaxError("';' expected after 'exit' or 'die' - // statement."); - // } - // getNextToken(); - // } - // return; - // } else if (token == TokenNamedefine) { - // getNextToken(); - // if (token == TokenNameLPAREN) { - // getNextToken(); - // } else { - // throwSyntaxError("'(' expected after 'define' keyword."); - // } - // expr(); - // if (token == TokenNameCOMMA) { - // getNextToken(); - // } else { - // throwSyntaxError("',' expected after first 'define' constant."); - // } - // expr(); - // if (token == TokenNameCOMMA) { - // getNextToken(); - // expr(); - // } - // if (token == TokenNameRPAREN) { - // getNextToken(); - // } else { - // throwSyntaxError("')' expected after 'define' statement."); - // } - // if (token == TokenNameSEMICOLON) { - // getNextToken(); - // } else { - // if (token != TokenNameStopPHP) { - // throwSyntaxError("';' expected after 'define' statement."); - // } - // getNextToken(); - // } - // return; } else if (token == TokenNamefunction) { MethodDeclaration methodDecl = new MethodDeclaration( this.compilationUnit.compilationResult); @@ -1282,6 +1238,57 @@ public class Parser //extends PHPParserSuperclass getNextToken(); functionDefinition(methodDecl); return; + } else if (token == TokenNametry) { + getNextToken(); +if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in 'try' statement."); + } + getNextToken(); + statementList(); +if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in 'try' statement."); + } +getNextToken(); + return; + } else if (token == TokenNamecatch) { +getNextToken(); +if (token != TokenNameLPAREN) { + throwSyntaxError("'(' expected in 'catch' statement."); + } + getNextToken(); + fully_qualified_class_name(); + if (token != TokenNameVariable) { + throwSyntaxError("Variable expected in 'catch' statement."); + } + getNextToken(); + + if (token != TokenNameRBRACE) { + throwSyntaxError("')' expected in 'catch' statement."); + } + getNextToken(); +getNextToken(); +if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in 'catch' statement."); + } + getNextToken(); + statementList(); +if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in 'catch' statement."); + } +getNextToken(); + additional_catches(); + return; + } else if (token == TokenNamethrow) { + getNextToken(); + + expr(); + if (token == TokenNameSEMICOLON) { + getNextToken(); + } else { + throwSyntaxError("';' expected after 'throw' exxpression."); + } + + return; } else if (token == TokenNamefinal || token == TokenNameabstract || token == TokenNameclass || token == TokenNameinterface) { TypeDeclaration typeDecl = new TypeDeclaration( @@ -1320,7 +1327,7 @@ public class Parser //extends PHPParserSuperclass getNextToken(); return; } else { - if (token != TokenNameStopPHP && token != TokenNameEOF) { + if (token != TokenNameINLINE_HTML && token != TokenNameEOF) { throwSyntaxError("';' expected after expression (Found token: " + scanner.toStringAction(token) + ")"); } @@ -1328,6 +1335,36 @@ public class Parser //extends PHPParserSuperclass } } } + private void additional_catches() { + while (token == TokenNamecatch) { + getNextToken(); + if (token != TokenNameLPAREN) { + throwSyntaxError("'(' expected in 'catch' statement."); + } + getNextToken(); + fully_qualified_class_name(); + if (token != TokenNameVariable) { + throwSyntaxError("Variable expected in 'catch' statement."); + } + getNextToken(); + + if (token != TokenNameRBRACE) { + throwSyntaxError("')' expected in 'catch' statement."); + } + getNextToken(); + getNextToken(); + if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in 'catch' statement."); + } + getNextToken(); + statementList(); + if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in 'catch' statement."); + } + getNextToken(); + } + } + private void global_var_list() { // global_var_list: // global_var_list ',' global_var @@ -2388,7 +2425,7 @@ public class Parser //extends PHPParserSuperclass } break; default : - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("Error in expression (found token '" + scanner.toStringAction(token) + "')."); } @@ -3234,7 +3271,7 @@ public class Parser //extends PHPParserSuperclass break; } getNextToken(); - if (token != TokenNameRPAREN) { + if (token == TokenNameRPAREN) { break; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index 041fd95..9b91cf2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -1081,7 +1081,7 @@ public class Scanner implements IScanner, ITerminalSymbols { case '?' : if (getNextChar('>')) { phpMode = false; - return TokenNameStopPHP; + return TokenNameINLINE_HTML; } return TokenNameQUESTION; case ':' : @@ -1522,7 +1522,7 @@ public class Scanner implements IScanner, ITerminalSymbols { if (getNextChar('>')) { startPosition = currentPosition - 2; phpMode = false; - return TokenNameStopPHP; + return TokenNameINLINE_HTML; } } //get the next char @@ -3471,7 +3471,7 @@ public class Scanner implements IScanner, ITerminalSymbols { case TokenNameERROR : return "ScannerError"; // + new String(getCurrentTokenSource()) + ")"; // //$NON-NLS-1$ - case TokenNameStopPHP : + case TokenNameINLINE_HTML : return "StopPHP(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameIdentifier : return "Identifier(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java index bdb0401..df61b62 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java @@ -14,9 +14,9 @@ import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.corext.Assert; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -256,7 +256,7 @@ public class ClasspathEntry implements IClasspathEntry { switch (kind) { case IClasspathEntry.CPE_PROJECT : - return PHPCore.newProjectEntry(path, isExported); + return JavaCore.newProjectEntry(path, isExported); // case IClasspathEntry.CPE_LIBRARY : // return JavaCore.newLibraryEntry( @@ -269,9 +269,9 @@ public class ClasspathEntry implements IClasspathEntry { // must be an entry in this project or specify another project String projSegment = path.segment(0); if (projSegment != null && projSegment.equals(project.getElementName())) { // this project - return PHPCore.newSourceEntry(path, exclusionPatterns, outputLocation); + return JavaCore.newSourceEntry(path, exclusionPatterns, outputLocation); } else { // another project - return PHPCore.newProjectEntry(path, isExported); + return JavaCore.newProjectEntry(path, isExported); } // case IClasspathEntry.CPE_VARIABLE : @@ -282,7 +282,7 @@ public class ClasspathEntry implements IClasspathEntry { // isExported); case IClasspathEntry.CPE_CONTAINER : - return PHPCore.newContainerEntry( + return JavaCore.newContainerEntry( path, isExported); @@ -582,6 +582,6 @@ public class ClasspathEntry implements IClasspathEntry { */ public IClasspathEntry getResolvedEntry() { - return PHPCore.getResolvedClasspathEntry(this); + return JavaCore.getResolvedClasspathEntry(this); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java index 6cfb4c4..695eb36 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java @@ -18,6 +18,7 @@ import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.CompilationResult; @@ -32,7 +33,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding; import net.sourceforge.phpdt.internal.compiler.parser.SourceTypeConverter; import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.core.runtime.IProgressMonitor; @@ -205,7 +205,7 @@ public class CompilationUnitProblemFinder extends Compiler { CompilationUnitDeclaration unit = null; try { - String encoding = project.getOption(PHPCore.CORE_ENCODING, true); + String encoding = project.getOption(JavaCore.CORE_ENCODING, true); IPackageFragment packageFragment = (IPackageFragment)unitElement.getAncestor(IJavaElement.PACKAGE_FRAGMENT); char[][] expectedPackageName = null; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java index 2e30065..e6d149e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java @@ -29,12 +29,12 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.jdom.DOMException; import net.sourceforge.phpdt.core.jdom.DOMFactory; import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit; import net.sourceforge.phpdt.core.jdom.IDOMNode; import net.sourceforge.phpdt.core.jdom.IDOMPackage; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; @@ -276,7 +276,7 @@ public class CopyResourceElementsOperation extends MultiOperation { // update new resource content try { if (newContent != null){ - String encoding = source.getJavaProject().getOption(PHPCore.CORE_ENCODING, true); + String encoding = source.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); destFile.setContents( new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), fForce ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, @@ -310,7 +310,7 @@ public class CopyResourceElementsOperation extends MultiOperation { // see http://dev.eclipse.org/bugs/show_bug.cgi?id=9351 try { if (newContent != null){ - String encoding = source.getJavaProject().getOption(PHPCore.CORE_ENCODING, true); + String encoding = source.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); destFile.setContents( new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), fForce ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java index 45ffede..bbfe240 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java @@ -22,8 +22,8 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModel; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; @@ -229,7 +229,7 @@ public class DeltaProcessor implements IResourceChangeListener { * to update. */ void addToProjectsToUpdateWithDependents(IProject project) { - this.projectsToUpdate.add(PHPCore.create(project)); + this.projectsToUpdate.add(JavaCore.create(project)); // this.addDependentProjects(project.getFullPath(), this.projectsToUpdate); } @@ -1114,7 +1114,7 @@ public class DeltaProcessor implements IResourceChangeListener { // source attachment path if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY) continue; - QualifiedName qName = new QualifiedName(PHPCore.PLUGIN_ID, "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; + QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; String propertyString = null; try { propertyString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java index 1838edf..4c295b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java @@ -39,8 +39,8 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpdt.internal.core.builder.PHPBuilder; @@ -248,13 +248,13 @@ public class JavaModelManager implements ISaveParticipant { int type = resource.getType(); switch (type) { case IResource.PROJECT : - return PHPCore.create((IProject) resource); + return JavaCore.create((IProject) resource); case IResource.FILE : return create((IFile) resource, project); case IResource.FOLDER : return create((IFolder) resource, project); case IResource.ROOT : - return PHPCore.create((IWorkspaceRoot) resource); + return JavaCore.create((IWorkspaceRoot) resource); default : return null; } @@ -280,7 +280,7 @@ public class JavaModelManager implements ISaveParticipant { return null; } if (project == null) { - project = PHPCore.create(file.getProject()); + project = JavaCore.create(file.getProject()); } if (file.getFileExtension() != null) { @@ -311,7 +311,7 @@ public class JavaModelManager implements ISaveParticipant { return null; } if (project == null) { - project = PHPCore.create(folder.getProject()); + project = JavaCore.create(folder.getProject()); } IJavaElement element = determineIfOnClasspath(folder, project); if (conflictsWithOutputLocation(folder.getFullPath(), (JavaProject)project) @@ -355,7 +355,7 @@ public class JavaModelManager implements ISaveParticipant { if (file == null) return null; if (project == null) { - project = PHPCore.create(file.getProject()); + project = JavaCore.create(file.getProject()); } IPackageFragment pkg = (IPackageFragment) determineIfOnClasspath(file, project); if (pkg == null) { @@ -655,7 +655,7 @@ public class JavaModelManager implements ISaveParticipant { * Configure the plugin with respect to option settings defined in ".options" file */ public void configurePluginDebugOptions(){ - if(PHPCore.getPlugin().isDebugging()){ + if(JavaCore.getPlugin().isDebugging()){ // TODO khartlage temp-del String option = Platform.getDebugOption(BUILDER_DEBUG); // if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ @@ -1000,7 +1000,7 @@ public class JavaModelManager implements ISaveParticipant { JavaModelManager.PerProjectInfo info = getPerProjectInfo(project, false /* don't create info */); if (info == null) { if (!JavaProject.hasJavaNature(project)) { - throw ((JavaProject)PHPCore.create(project)).newNotPresentException(); + throw ((JavaProject)JavaCore.create(project)).newNotPresentException(); } info = getPerProjectInfo(project, true /* create info */); } @@ -1012,7 +1012,7 @@ public class JavaModelManager implements ISaveParticipant { */ public static String[] getRegisteredVariableNames(){ - Plugin jdtCorePlugin = PHPCore.getPlugin(); + Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; ArrayList variableList = new ArrayList(5); @@ -1062,7 +1062,7 @@ public class JavaModelManager implements ISaveParticipant { */ private File getSerializationFile(IProject project) { if (!project.exists()) return null; - IPluginDescriptor descr= PHPCore.getJavaCore().getDescriptor(); + IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor(); IPath workingLocation= project.getPluginWorkingLocation(descr); return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$ } @@ -1094,18 +1094,18 @@ public class JavaModelManager implements ISaveParticipant { } else { // internal resource (not an IFile or not existing) IPath location; if (file.getType() != IResource.FILE || (location = file.getLocation()) == null) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } } else if (!path.isAbsolute()) { file= root.getFile(path); if (file == null || file.getType() != IResource.FILE) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } IPath location = file.getLocation(); if (location == null) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } else { @@ -1122,7 +1122,7 @@ public class JavaModelManager implements ISaveParticipant { } return zipFile; } catch (IOException e) { - throw new CoreException(new Status(Status.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ + throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ } } } @@ -1297,7 +1297,7 @@ public class JavaModelManager implements ISaveParticipant { DataInputStream in= new DataInputStream(new BufferedInputStream(new FileInputStream(file))); try { String pluginID= in.readUTF(); - if (!pluginID.equals(PHPCore.PLUGIN_ID)) + if (!pluginID.equals(JavaCore.PLUGIN_ID)) throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$ String kind= in.readUTF(); if (!kind.equals("STATE")) //$NON-NLS-1$ @@ -1311,7 +1311,7 @@ public class JavaModelManager implements ISaveParticipant { } } catch (Exception e) { e.printStackTrace(); - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ } } return null; @@ -1453,7 +1453,7 @@ public class JavaModelManager implements ISaveParticipant { try { DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); try { - out.writeUTF(PHPCore.PLUGIN_ID); + out.writeUTF(JavaCore.PLUGIN_ID); out.writeUTF("STATE"); //$NON-NLS-1$ if (info.savedState == null) { out.writeBoolean(false); @@ -1467,12 +1467,12 @@ public class JavaModelManager implements ISaveParticipant { } catch (RuntimeException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( - new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } catch (IOException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( - new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } if (PHPBuilder.DEBUG) { @@ -1508,7 +1508,7 @@ public class JavaModelManager implements ISaveParticipant { if (vStats != null) { IStatus[] stats= new IStatus[vStats.size()]; vStats.toArray(stats); - throw new CoreException(new MultiStatus(PHPCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ + throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ } } @@ -1520,7 +1520,7 @@ public class JavaModelManager implements ISaveParticipant { // optional behaviour // possible value of index 0 is Compute - if (!PHPCore.COMPUTE.equals(PHPCore.getOption(PHPCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level + if (!JavaCore.COMPUTE.equals(JavaCore.getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level if (javaBuildOrder == null || javaBuildOrder.length <= 1) return; @@ -1661,11 +1661,11 @@ public class JavaModelManager implements ISaveParticipant { if (variablePath == JavaModelManager.VariableInitializationInProgress){ return; } - Preferences preferences = PHPCore.getPlugin().getPluginPreferences(); + Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString(); preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones preferences.setValue(variableKey, variableString); - PHPCore.getPlugin().savePluginPreferences(); + JavaCore.getPlugin().savePluginPreferences(); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java index 37a591d..9f7e031 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java @@ -13,7 +13,7 @@ package net.sourceforge.phpdt.internal.core; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelStatus; import net.sourceforge.phpdt.core.IJavaModelStatusConstants; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import org.eclipse.core.resources.IResourceStatus; import org.eclipse.core.runtime.CoreException; @@ -68,13 +68,13 @@ public class JavaModelStatus */ public JavaModelStatus() { // no code for an multi-status - super(ERROR, PHPCore.PLUGIN_ID, 0, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, 0, "JavaModelStatus", null); //$NON-NLS-1$ } /** * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; } @@ -83,7 +83,7 @@ public class JavaModelStatus * elements. */ public JavaModelStatus(int code, IJavaElement[] elements) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ fElements = elements; fPath = null; } @@ -97,7 +97,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int severity, int code, String string) { - super(severity, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(severity, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; fPath = null; @@ -107,7 +107,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, Throwable throwable) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", throwable); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", throwable); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; } @@ -115,7 +115,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, IPath path) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; fPath = path; @@ -148,7 +148,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(CoreException coreException) { - super(ERROR, PHPCore.PLUGIN_ID, CORE_EXCEPTION, "JavaModelStatus", coreException); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, CORE_EXCEPTION, "JavaModelStatus", coreException); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java index a634464..3215459 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java @@ -44,11 +44,11 @@ import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.codeassist.ISearchableNameEnvironment; import net.sourceforge.phpdt.internal.compiler.util.ObjectVector; import net.sourceforge.phpdt.internal.corext.Assert; import net.sourceforge.phpeclipse.LoadPathEntry; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.apache.xerces.dom.DocumentImpl; @@ -419,7 +419,7 @@ public class JavaProject if (member != null && member.getType() == IResource.PROJECT){ // double check if bound to project (23977) IProject projRsc = (IProject) member; if (JavaProject.hasJavaNature(projRsc)) { - JavaProject project = (JavaProject) PHPCore.create(projRsc); + JavaProject project = (JavaProject) JavaCore.create(projRsc); project.computeExpandedClasspath( initialProject, ignoreUnresolvedVariable, @@ -560,7 +560,7 @@ public class JavaProject IProject requiredProjectRsc = (IProject) member; if (JavaProject.hasJavaNature(requiredProjectRsc)){ // special builder binary output rootIDs.add(rootID); - JavaProject requiredProject = (JavaProject)PHPCore.create(requiredProjectRsc); + JavaProject requiredProject = (JavaProject)JavaCore.create(requiredProjectRsc); requiredProject.computePackageFragmentRoots( requiredProject.getResolvedClasspath(true), accumulatedRoots, @@ -680,7 +680,7 @@ public class JavaProject case IJavaModelStatusConstants.CLASSPATH_CYCLE : isCycleProblem = true; - if (PHPCore.ERROR.equals(getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true))) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING; @@ -695,7 +695,7 @@ public class JavaProject default: IPath path = status.getPath(); if (path != null) arguments = new String[] { path.toString() }; - if (PHPCore.ERROR.equals(getOption(PHPCore.CORE_INCOMPLETE_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true))) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING; @@ -836,7 +836,7 @@ public class JavaProject protected IClasspathEntry[] defaultClasspath() throws JavaModelException { return new IClasspathEntry[] { - PHPCore.newSourceEntry(getProject().getFullPath())}; + JavaCore.newSourceEntry(getProject().getFullPath())}; } /** @@ -1296,7 +1296,7 @@ public class JavaProject Preferences preferences = getPreferences(); if (preferences == null || preferences.isDefault(optionName)) { - return inheritJavaCoreOptions ? PHPCore.getOption(optionName) : null; + return inheritJavaCoreOptions ? JavaCore.getOption(optionName) : null; } return preferences.getString(optionName).trim(); } @@ -1309,7 +1309,7 @@ public class JavaProject public Map getOptions(boolean inheritJavaCoreOptions) { // initialize to the defaults from JavaCore options pool - Map options = inheritJavaCoreOptions ? PHPCore.getOptions() : new Hashtable(5); + Map options = inheritJavaCoreOptions ? JavaCore.getOptions() : new Hashtable(5); Preferences preferences = getPreferences(); if (preferences == null) return options; // cannot do better (non-Java project) @@ -1693,7 +1693,7 @@ public class JavaProject case IClasspathEntry.CPE_VARIABLE : - IClasspathEntry resolvedEntry = PHPCore.getResolvedClasspathEntry(rawEntry); + IClasspathEntry resolvedEntry = JavaCore.getResolvedClasspathEntry(rawEntry); if (resolvedEntry == null) { if (!ignoreUnresolvedEntry) throw new JavaModelException(status); } else { @@ -1955,7 +1955,7 @@ public class JavaProject Preferences preferences = new Preferences(); // File prefFile = getProject().getLocation().append(PREF_FILENAME).toFile(); - IPath projectMetaLocation = getProject().getPluginWorkingLocation(PHPCore.getPlugin().getDescriptor()); + IPath projectMetaLocation = getProject().getPluginWorkingLocation(JavaCore.getPlugin().getDescriptor()); if (projectMetaLocation != null) { File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile(); if (prefFile.exists()) { // load preferences from file @@ -2164,7 +2164,7 @@ public class JavaProject // the preferences file is located in the plug-in's state area // at a well-known name (.jprefs) // File prefFile = getProject().getLocation().append(PREF_FILENAME).toFile(); - File prefFile = project.getPluginWorkingLocation(PHPCore.getPlugin().getDescriptor()).append(PREF_FILENAME).toFile(); + File prefFile = project.getPluginWorkingLocation(JavaCore.getPlugin().getDescriptor()).append(PREF_FILENAME).toFile(); if (preferences.propertyNames().length == 0) { // there are no preference settings // rather than write an empty file, just delete any existing file @@ -2438,8 +2438,8 @@ public class JavaProject if (cycleParticipants.contains(project.getPath())){ IMarker cycleMarker = project.getCycleMarker(); - String circularCPOption = project.getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true); - int circularCPSeverity = PHPCore.ERROR.equals(circularCPOption) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; + String circularCPOption = project.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true); + int circularCPSeverity = JavaCore.ERROR.equals(circularCPOption) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; if (cycleMarker != null) { // update existing cycle marker if needed try { @@ -2491,7 +2491,7 @@ public class JavaProject if (!traversed.contains(prereqProjectPath)) { IResource member = workspaceRoot.findMember(prereqProjectPath); if (member != null && member.getType() == IResource.PROJECT){ - JavaProject project = (JavaProject)PHPCore.create((IProject)member); + JavaProject project = (JavaProject)JavaCore.create((IProject)member); project.updateCycleParticipants(null, prereqChain, cycleParticipants, workspaceRoot, traversed); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java index d32a9d3..f2d66c4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java @@ -24,8 +24,8 @@ import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; import net.sourceforge.phpdt.core.ICompilationUnit; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.util.PerThreadObject; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; @@ -260,7 +260,7 @@ public class NameLookup { } } } else { - IJavaElement fromFactory = PHPCore.create(possibleFragment); + IJavaElement fromFactory = JavaCore.create(possibleFragment); if (fromFactory == null) { return null; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java index 11aec11..f3e3f82 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java @@ -17,8 +17,8 @@ import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; @@ -623,7 +623,7 @@ public IResource getResource() { * of this root. */ protected QualifiedName getSourceAttachmentPropertyName() throws JavaModelException { - return new QualifiedName(PHPCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$ + return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$ } public void setSourceAttachmentProperty(String property) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java index 825cd1a..93e8ef0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java @@ -22,12 +22,12 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelStatusConstants; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.Signature; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.core.util.CharArrayBuffer; import net.sourceforge.phpdt.internal.corext.Assert; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; @@ -619,7 +619,7 @@ public class Util { * Returns the given file's contents as a character array. */ public static char[] getResourceContentsAsCharArray(IFile file) throws JavaModelException { - String encoding = PHPCore.create(file.getProject()).getOption(PHPCore.CORE_ENCODING, true); + String encoding = JavaCore.create(file.getProject()).getOption(JavaCore.CORE_ENCODING, true); return getResourceContentsAsCharArray(file, encoding); } @@ -848,11 +848,11 @@ public class Util { } IStatus status= new Status( IStatus.ERROR, - PHPCore.getPlugin().getDescriptor().getUniqueIdentifier(), + JavaCore.getPlugin().getDescriptor().getUniqueIdentifier(), IStatus.ERROR, message, e); - PHPCore.getPlugin().getLog().log(status); + JavaCore.getPlugin().getLog().log(status); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java index 416eb26..f101c98 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java @@ -25,7 +25,7 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; @@ -89,7 +89,7 @@ public void commit(boolean force, IProgressMonitor monitor) throws JavaModelExce CommitWorkingCopyOperation op= new CommitWorkingCopyOperation(this, force); runOperation(op, monitor); } else { - String encoding = this.getJavaProject().getOption(PHPCore.CORE_ENCODING, true); + String encoding = this.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); String contents = this.getSource(); if (contents == null) return; try { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java index 6b40b16..e79256b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java @@ -15,6 +15,7 @@ import java.util.Locale; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.Compiler; import net.sourceforge.phpdt.internal.compiler.CompilationResult; @@ -22,7 +23,6 @@ import net.sourceforge.phpdt.internal.compiler.DefaultErrorHandlingPolicies; import net.sourceforge.phpdt.internal.compiler.ICompilerRequestor; import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation; import net.sourceforge.phpdt.internal.core.Util; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; @@ -65,7 +65,7 @@ protected AbstractImageBuilder(PHPBuilder javaBuilder) { this.sourceLocations = this.nameEnvironment.sourceLocations; this.notifier = javaBuilder.notifier; - this.encoding = javaBuilder.javaProject.getOption(PHPCore.CORE_ENCODING, true); + this.encoding = javaBuilder.javaProject.getOption(JavaCore.CORE_ENCODING, true); this.compiler = newCompiler(); this.workQueue = new WorkQueue(); this.problemSourceFiles = new ArrayList(3); @@ -215,7 +215,7 @@ protected void createErrorFor(IResource resource, String message) { IMarker marker = resource.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); int severity = IMarker.SEVERITY_ERROR; if (message.equals(Util.bind("build.duplicateResource"))) //$NON-NLS-1$ - if (PHPCore.WARNING.equals(javaBuilder.javaProject.getOption(PHPCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE, true))) + if (JavaCore.WARNING.equals(javaBuilder.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE, true))) severity = IMarker.SEVERITY_WARNING; marker.setAttributes( new String[] {IMarker.MESSAGE, IMarker.SEVERITY, IMarker.CHAR_START, IMarker.CHAR_END}, @@ -387,9 +387,9 @@ protected void storeTasksFor(SourceFile sourceFile, IProblem[] tasks) throws Cor IMarker marker = resource.createMarker(IJavaModelMarker.TASK_MARKER); int priority = IMarker.PRIORITY_NORMAL; String compilerPriority = task.getArguments()[2]; - if (PHPCore.COMPILER_TASK_PRIORITY_HIGH.equals(compilerPriority)) + if (JavaCore.COMPILER_TASK_PRIORITY_HIGH.equals(compilerPriority)) priority = IMarker.PRIORITY_HIGH; - else if (PHPCore.COMPILER_TASK_PRIORITY_LOW.equals(compilerPriority)) + else if (JavaCore.COMPILER_TASK_PRIORITY_LOW.equals(compilerPriority)) priority = IMarker.PRIORITY_LOW; marker.setAttributes( new String[] { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java index 2be5495..967d8c3 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java @@ -12,9 +12,9 @@ package net.sourceforge.phpdt.internal.core.builder; import java.util.ArrayList; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.core.Util; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.builder.IdentifierIndexManager; @@ -102,8 +102,8 @@ protected void addAllSourceFiles(final ArrayList sourceFiles) throws CoreExcepti } protected void cleanOutputFolders() throws CoreException { - boolean deleteAll = PHPCore.CLEAN.equals( - javaBuilder.javaProject.getOption(PHPCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); + boolean deleteAll = JavaCore.CLEAN.equals( + javaBuilder.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); if (deleteAll) { ArrayList visited = new ArrayList(sourceLocations.length); for (int i = 0, l = sourceLocations.length; i < l; i++) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java index 635ac56..ffbe886 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java @@ -137,7 +137,7 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { / allSourceFiles.length); increment = increment / 2; compile(allSourceFiles); - removeSecondaryTypes(); +// removeSecondaryTypes(); addAffectedSourceFiles(); } if (this.hasStructuralChanges && javaBuilder.javaProject.hasCycleMarker()) @@ -171,41 +171,41 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { // if a well known name was found then we can skip over these if (simpleNames.length < simpleStrings.size()) simpleNames = null; - Object[] keyTable = newState.references.keyTable; - Object[] valueTable = newState.references.valueTable; - next : for (int i = 0, l = valueTable.length; i < l; i++) { - ReferenceCollection refs = (ReferenceCollection) valueTable[i]; - if (refs != null && refs.includes(qualifiedNames, simpleNames)) { - String typeLocator = (String) keyTable[i]; - IFile file = javaBuilder.currentProject.getFile(typeLocator); - if (file.exists()) { - ClasspathMultiDirectory md = sourceLocations[0]; - if (sourceLocations.length > 1) { - IPath sourceFileFullPath = file.getFullPath(); - for (int j = 0, m = sourceLocations.length; j < m; j++) { - if (sourceLocations[j].sourceFolder.getFullPath().isPrefixOf( - sourceFileFullPath)) { - md = sourceLocations[j]; - if (md.exclusionPatterns == null - || !Util.isExcluded(file, md.exclusionPatterns)) - break; - } - } - } - SourceFile sourceFile = new SourceFile(file, md, encoding); - if (sourceFiles.contains(sourceFile)) - continue next; - if (compiledAllAtOnce && previousSourceFiles != null - && previousSourceFiles.contains(sourceFile)) - continue next; // can skip previously compiled files since already - // saw hierarchy related problems - if (PHPBuilder.DEBUG) - System.out.println(" adding affected source file " + typeLocator); //$NON-NLS-1$ - // // update indexfile for the project: - sourceFiles.add(sourceFile); - } - } - } +// Object[] keyTable = newState.references.keyTable; +// Object[] valueTable = newState.references.valueTable; +// next : for (int i = 0, l = valueTable.length; i < l; i++) { +// ReferenceCollection refs = (ReferenceCollection) valueTable[i]; +// if (refs != null && refs.includes(qualifiedNames, simpleNames)) { +// String typeLocator = (String) keyTable[i]; +// IFile file = javaBuilder.currentProject.getFile(typeLocator); +// if (file.exists()) { +// ClasspathMultiDirectory md = sourceLocations[0]; +// if (sourceLocations.length > 1) { +// IPath sourceFileFullPath = file.getFullPath(); +// for (int j = 0, m = sourceLocations.length; j < m; j++) { +// if (sourceLocations[j].sourceFolder.getFullPath().isPrefixOf( +// sourceFileFullPath)) { +// md = sourceLocations[j]; +// if (md.exclusionPatterns == null +// || !Util.isExcluded(file, md.exclusionPatterns)) +// break; +// } +// } +// } +// SourceFile sourceFile = new SourceFile(file, md, encoding); +// if (sourceFiles.contains(sourceFile)) +// continue next; +// if (compiledAllAtOnce && previousSourceFiles != null +// && previousSourceFiles.contains(sourceFile)) +// continue next; // can skip previously compiled files since already +// // saw hierarchy related problems +// if (PHPBuilder.DEBUG) +// System.out.println(" adding affected source file " + typeLocator); //$NON-NLS-1$ +// // // update indexfile for the project: +// sourceFiles.add(sourceFile); +// } +// } +// } } protected void addDependentsOf(IPath path, boolean hasStructuralChanges) { if (hasStructuralChanges) { @@ -292,12 +292,12 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { if (binaryDelta.getKind() == IResourceDelta.ADDED) { // see if any known source file is from the same package... // classpath already includes new package - if (!newState.isKnownPackage(packageName)) { - if (PHPBuilder.DEBUG) - System.out.println("Found added package " + packageName); //$NON-NLS-1$ - addDependentsOf(packagePath, false); - return; - } +// if (!newState.isKnownPackage(packageName)) { +// if (PHPBuilder.DEBUG) +// System.out.println("Found added package " + packageName); //$NON-NLS-1$ +// addDependentsOf(packagePath, false); +// return; +// } if (PHPBuilder.DEBUG) System.out.println("Skipped dependents of added package " + packageName); //$NON-NLS-1$ @@ -453,37 +453,37 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { + typeLocator); //$NON-NLS-1$ sourceFiles.add(new SourceFile((IFile) resource, md, encoding)); String typeName = typePath.toString(); - if (!newState.isDuplicateLocator(typeName, typeLocator)) { // adding - // dependents - // results - // in - // 2 - // duplicate - // errors - if (PHPBuilder.DEBUG) - System.out.println("Found added source file " + typeName); //$NON-NLS-1$ - addDependentsOf(typePath, true); - } +// if (!newState.isDuplicateLocator(typeName, typeLocator)) { // adding +// // dependents +// // results +// // in +// // 2 +// // duplicate +// // errors +// if (PHPBuilder.DEBUG) +// System.out.println("Found added source file " + typeName); //$NON-NLS-1$ +// addDependentsOf(typePath, true); +// } return; case IResourceDelta.REMOVED : - char[][] definedTypeNames = newState - .getDefinedTypeNamesFor(typeLocator); - if (definedTypeNames == null) { // defined a single type matching - // typePath - removeClassFile(typePath, md.binaryFolder); - if ((sourceDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) { - // remove problems and tasks for a compilation unit that is - // being moved (to another package or renamed) - // if the target file is a compilation unit, the new cu will - // be recompiled - // if the target file is a non-java resource, then markers - // are removed - // see bug 2857 - IResource movedFile = javaBuilder.workspaceRoot - .getFile(sourceDelta.getMovedToPath()); - PHPBuilder.removeProblemsAndTasksFor(movedFile); - } - } else { +// char[][] definedTypeNames = newState +// .getDefinedTypeNamesFor(typeLocator); +// if (definedTypeNames == null) { // defined a single type matching +// // typePath +// removeClassFile(typePath, md.binaryFolder); +// if ((sourceDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) { +// // remove problems and tasks for a compilation unit that is +// // being moved (to another package or renamed) +// // if the target file is a compilation unit, the new cu will +// // be recompiled +// // if the target file is a non-java resource, then markers +// // are removed +// // see bug 2857 +// IResource movedFile = javaBuilder.workspaceRoot +// .getFile(sourceDelta.getMovedToPath()); +// PHPBuilder.removeProblemsAndTasksFor(movedFile); +// } +// } else { if (PHPBuilder.DEBUG) System.out.println("Found removed source file " + typePath.toString()); //$NON-NLS-1$ @@ -491,16 +491,16 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { // source file since it may be // involved in a name // collision - if (definedTypeNames.length > 0) { // skip it if it failed to - // successfully define a - // type - IPath packagePath = typePath.removeLastSegments(1); - for (int i = 0, l = definedTypeNames.length; i < l; i++) - removeClassFile(packagePath.append(new String( - definedTypeNames[i])), md.binaryFolder); - } - } - newState.removeLocator(typeLocator); +// if (definedTypeNames.length > 0) { // skip it if it failed to +// // successfully define a +// // type +// IPath packagePath = typePath.removeLastSegments(1); +// for (int i = 0, l = definedTypeNames.length; i < l; i++) +// removeClassFile(packagePath.append(new String( +// definedTypeNames[i])), md.binaryFolder); +// } +// } +// newState.removeLocator(typeLocator); return; case IResourceDelta.CHANGED : if ((sourceDelta.getFlags() & IResourceDelta.CONTENT) == 0) @@ -573,73 +573,73 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { protected void finishedWith(String sourceLocator, CompilationResult result, char[] mainTypeName, ArrayList definedTypeNames, ArrayList duplicateTypeNames) throws CoreException { - char[][] previousTypeNames = newState.getDefinedTypeNamesFor(sourceLocator); - if (previousTypeNames == null) - previousTypeNames = new char[][]{mainTypeName}; - IPath packagePath = null; - next : for (int i = 0, l = previousTypeNames.length; i < l; i++) { - char[] previous = previousTypeNames[i]; - for (int j = 0, m = definedTypeNames.size(); j < m; j++) - if (CharOperation.equals(previous, (char[]) definedTypeNames.get(j))) - continue next; - SourceFile sourceFile = (SourceFile) result.getCompilationUnit(); - if (packagePath == null) { - int count = sourceFile.sourceLocation.sourceFolder.getFullPath() - .segmentCount(); - packagePath = sourceFile.resource.getFullPath().removeFirstSegments( - count).removeLastSegments(1); - } - if (secondaryTypesToRemove == null) - this.secondaryTypesToRemove = new SimpleLookupTable(); - ArrayList types = (ArrayList) secondaryTypesToRemove - .get(sourceFile.sourceLocation.binaryFolder); - if (types == null) - types = new ArrayList(definedTypeNames.size()); - types.add(packagePath.append(new String(previous))); - secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, types); - } +// char[][] previousTypeNames = newState.getDefinedTypeNamesFor(sourceLocator); +// if (previousTypeNames == null) +// previousTypeNames = new char[][]{mainTypeName}; +// IPath packagePath = null; +// next : for (int i = 0, l = previousTypeNames.length; i < l; i++) { +// char[] previous = previousTypeNames[i]; +// for (int j = 0, m = definedTypeNames.size(); j < m; j++) +// if (CharOperation.equals(previous, (char[]) definedTypeNames.get(j))) +// continue next; +// SourceFile sourceFile = (SourceFile) result.getCompilationUnit(); +// if (packagePath == null) { +// int count = sourceFile.sourceLocation.sourceFolder.getFullPath() +// .segmentCount(); +// packagePath = sourceFile.resource.getFullPath().removeFirstSegments( +// count).removeLastSegments(1); +// } +// if (secondaryTypesToRemove == null) +// this.secondaryTypesToRemove = new SimpleLookupTable(); +// ArrayList types = (ArrayList) secondaryTypesToRemove +// .get(sourceFile.sourceLocation.binaryFolder); +// if (types == null) +// types = new ArrayList(definedTypeNames.size()); +// types.add(packagePath.append(new String(previous))); +// secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, types); +// } // super.finishedWith(sourceLocator, result, mainTypeName, // definedTypeNames, duplicateTypeNames); } - protected void removeClassFile(IPath typePath, IContainer outputFolder) - throws CoreException { - if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type - newState.removeQualifiedTypeName(typePath.toString()); - // add dependents even when the type thinks it does not exist to be on - // the safe side - if (PHPBuilder.DEBUG) - System.out.println("Found removed type " + typePath); //$NON-NLS-1$ - addDependentsOf(typePath, true); // when member types are removed, their - // enclosing type is structurally - // changed - } - IFile classFile = outputFolder.getFile(typePath - .addFileExtension(PHPBuilder.CLASS_EXTENSION)); - if (classFile.exists()) { - if (PHPBuilder.DEBUG) - System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ - classFile.delete(IResource.FORCE, null); - } - } - protected void removeSecondaryTypes() throws CoreException { - if (secondaryTypesToRemove != null) { // delayed deleting secondary types - // until the end of the compile loop - Object[] keyTable = secondaryTypesToRemove.keyTable; - Object[] valueTable = secondaryTypesToRemove.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - IContainer outputFolder = (IContainer) keyTable[i]; - if (outputFolder != null) { - ArrayList paths = (ArrayList) valueTable[i]; - for (int j = 0, m = paths.size(); j < m; j++) - removeClassFile((IPath) paths.get(j), outputFolder); - } - } - this.secondaryTypesToRemove = null; - if (previousSourceFiles != null && previousSourceFiles.size() > 1) - this.previousSourceFiles = null; // cannot optimize recompile case when - // a secondary type is deleted - } - } +// protected void removeClassFile(IPath typePath, IContainer outputFolder) +// throws CoreException { +// if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type +// newState.removeQualifiedTypeName(typePath.toString()); +// // add dependents even when the type thinks it does not exist to be on +// // the safe side +// if (PHPBuilder.DEBUG) +// System.out.println("Found removed type " + typePath); //$NON-NLS-1$ +// addDependentsOf(typePath, true); // when member types are removed, their +// // enclosing type is structurally +// // changed +// } +// IFile classFile = outputFolder.getFile(typePath +// .addFileExtension(PHPBuilder.CLASS_EXTENSION)); +// if (classFile.exists()) { +// if (PHPBuilder.DEBUG) +// System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ +// classFile.delete(IResource.FORCE, null); +// } +// } +// protected void removeSecondaryTypes() throws CoreException { +// if (secondaryTypesToRemove != null) { // delayed deleting secondary types +// // until the end of the compile loop +// Object[] keyTable = secondaryTypesToRemove.keyTable; +// Object[] valueTable = secondaryTypesToRemove.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// IContainer outputFolder = (IContainer) keyTable[i]; +// if (outputFolder != null) { +// ArrayList paths = (ArrayList) valueTable[i]; +// for (int j = 0, m = paths.size(); j < m; j++) +// removeClassFile((IPath) paths.get(j), outputFolder); +// } +// } +// this.secondaryTypesToRemove = null; +// if (previousSourceFiles != null && previousSourceFiles.size() > 1) +// this.previousSourceFiles = null; // cannot optimize recompile case when +// // a secondary type is deleted +// } +// } protected void resetCollections() { previousSourceFiles = sourceFiles.isEmpty() ? null diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java index 9265c4c..50456a0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaProject; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment; import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer; @@ -22,7 +23,6 @@ import net.sourceforge.phpdt.internal.core.ClasspathEntry; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaProject; import net.sourceforge.phpdt.internal.core.util.SimpleLookupTable; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; @@ -93,7 +93,7 @@ public class NameEnvironment implements INameEnvironment { /* Update cycle marker */ IMarker cycleMarker = javaProject.getCycleMarker(); if (cycleMarker != null) { - int severity = PHPCore.ERROR.equals(javaProject.getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true)) + int severity = JavaCore.ERROR.equals(javaProject.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true)) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; if (severity != ((Integer) cycleMarker.getAttribute(IMarker.SEVERITY)).intValue()) @@ -131,7 +131,7 @@ public class NameEnvironment implements INameEnvironment { IProject prereqProject = (IProject) target; if (!JavaProject.hasJavaNature(prereqProject)) continue nextEntry; // if project doesn't have java nature or is not accessible - JavaProject prereqJavaProject = (JavaProject) PHPCore.create(prereqProject); + 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++) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java index 575bb44..f7a56a6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java @@ -20,6 +20,7 @@ import java.util.Map; import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaModelManager; @@ -27,7 +28,6 @@ import net.sourceforge.phpdt.internal.core.JavaProject; import net.sourceforge.phpdt.internal.core.Util; import net.sourceforge.phpdt.internal.core.util.SimpleLookupTable; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.builder.IdentifierIndexManager; import net.sourceforge.phpeclipse.phpeditor.PHPParserAction; @@ -532,7 +532,7 @@ public class PHPBuilder extends IncrementalProjectBuilder { return false; } private void initializeBuilder() throws CoreException { - this.javaProject = (JavaProject) PHPCore.create(currentProject); + this.javaProject = (JavaProject) JavaCore.create(currentProject); this.workspaceRoot = currentProject.getWorkspace().getRoot(); // Flush the existing external files cache if this is the beginning of a // build cycle @@ -546,7 +546,7 @@ public class PHPBuilder extends IncrementalProjectBuilder { this.nameEnvironment = new NameEnvironment(workspaceRoot, javaProject, binaryLocationsPerProject); String filterSequence = javaProject.getOption( - PHPCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, true); + JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, true); char[][] filters = filterSequence != null && filterSequence.length() > 0 ? CharOperation.splitAndTrimOn(',', filterSequence.toCharArray()) : null; @@ -591,8 +591,8 @@ public class PHPBuilder extends IncrementalProjectBuilder { return false; } private boolean isWorthBuilding() throws CoreException { - boolean abortBuilds = PHPCore.ABORT.equals(javaProject.getOption( - PHPCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, true)); + boolean abortBuilds = JavaCore.ABORT.equals(javaProject.getOption( + JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, true)); if (!abortBuilds) return true; // Abort build only if there are classpath errors @@ -622,10 +622,10 @@ public class PHPBuilder extends IncrementalProjectBuilder { if (getLastState(p) == null) { // The prereq project has no build state: if this prereq project has a // 'warning' cycle marker then allow build (see bug id 23357) - JavaProject prereq = (JavaProject) PHPCore.create(p); + JavaProject prereq = (JavaProject) JavaCore.create(p); if (prereq.hasCycleMarker() - && PHPCore.WARNING.equals(javaProject.getOption( - PHPCore.CORE_CIRCULAR_CLASSPATH, true))) + && JavaCore.WARNING.equals(javaProject.getOption( + JavaCore.CORE_CIRCULAR_CLASSPATH, true))) continue; if (DEBUG) System.out.println("Aborted build because prereq project " diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java index 06bf6ca..9b0a223 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java @@ -36,9 +36,9 @@ public class State { //ClasspathLocation[] binaryLocations; // keyed by the project relative path of the type (ie. "src1/p1/p2/A.java"), value is a ReferenceCollection or an // AdditionalTypeCollection - SimpleLookupTable references; +// SimpleLookupTable references; // keyed by qualified type name "p1/p2/A", value is the project relative path which defines this type "src1/p1/p2/A.java" - SimpleLookupTable typeLocators; +// SimpleLookupTable typeLocators; int buildNumber; long lastStructuralBuildTime; @@ -61,8 +61,8 @@ public class State { this.javaProjectName = javaBuilder.currentProject.getName(); this.sourceLocations = javaBuilder.nameEnvironment.sourceLocations; // this.binaryLocations = javaBuilder.nameEnvironment.binaryLocations; - this.references = new SimpleLookupTable(7); - this.typeLocators = new SimpleLookupTable(7); +// this.references = new SimpleLookupTable(7); +// this.typeLocators = new SimpleLookupTable(7); this.buildNumber = 0; // indicates a full build this.lastStructuralBuildTime = System.currentTimeMillis(); @@ -70,91 +70,91 @@ public class State { } void copyFrom(State lastState) { - try { +// try { this.knownPackageNames = null; this.buildNumber = lastState.buildNumber + 1; this.lastStructuralBuildTime = lastState.lastStructuralBuildTime; - this.references = (SimpleLookupTable) lastState.references.clone(); - this.typeLocators = (SimpleLookupTable) lastState.typeLocators.clone(); - } catch (CloneNotSupportedException e) { - this.references = new SimpleLookupTable(lastState.references.elementSize); - Object[] keyTable = lastState.references.keyTable; - Object[] valueTable = lastState.references.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) - if (keyTable[i] != null) - this.references.put(keyTable[i], valueTable[i]); - - this.typeLocators = new SimpleLookupTable(lastState.typeLocators.elementSize); - keyTable = lastState.typeLocators.keyTable; - valueTable = lastState.typeLocators.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) - if (keyTable[i] != null) - this.typeLocators.put(keyTable[i], valueTable[i]); - } - } - - char[][] getDefinedTypeNamesFor(String typeLocator) { - Object c = references.get(typeLocator); - if (c instanceof AdditionalTypeCollection) - return ((AdditionalTypeCollection) c).definedTypeNames; - return null; // means only one type is defined with the same name as the file... saves space - } - - boolean isDuplicateLocator(String qualifiedTypeName, String typeLocator) { - String existing = (String) typeLocators.get(qualifiedTypeName); - return existing != null && !existing.equals(typeLocator); - } - - boolean isKnownPackage(String qualifiedPackageName) { - if (knownPackageNames == null) { - ArrayList names = new ArrayList(typeLocators.elementSize); - Object[] keyTable = typeLocators.keyTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - String packageName = (String) keyTable[i]; // is a type name of the form p1/p2/A - int last = packageName.lastIndexOf('/'); - packageName = last == -1 ? null : packageName.substring(0, last); - while (packageName != null && !names.contains(packageName)) { - names.add(packageName); - last = packageName.lastIndexOf('/'); - packageName = last == -1 ? null : packageName.substring(0, last); - } - } - } - knownPackageNames = new String[names.size()]; - names.toArray(knownPackageNames); - } - for (int i = 0, l = knownPackageNames.length; i < l; i++) - if (knownPackageNames[i].equals(qualifiedPackageName)) - return true; - return false; +// this.references = (SimpleLookupTable) lastState.references.clone(); +// this.typeLocators = (SimpleLookupTable) lastState.typeLocators.clone(); +// } catch (CloneNotSupportedException e) { +// this.references = new SimpleLookupTable(lastState.references.elementSize); +// Object[] keyTable = lastState.references.keyTable; +// Object[] valueTable = lastState.references.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) +// if (keyTable[i] != null) +// this.references.put(keyTable[i], valueTable[i]); +// +// this.typeLocators = new SimpleLookupTable(lastState.typeLocators.elementSize); +// keyTable = lastState.typeLocators.keyTable; +// valueTable = lastState.typeLocators.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) +// if (keyTable[i] != null) +// this.typeLocators.put(keyTable[i], valueTable[i]); +// } } - void record(String typeLocator, char[][][] qualifiedRefs, char[][] simpleRefs, char[] mainTypeName, ArrayList typeNames) { - if (typeNames.size() == 1 && CharOperation.equals(mainTypeName, (char[]) typeNames.get(0))) { - references.put(typeLocator, new ReferenceCollection(qualifiedRefs, simpleRefs)); - } else { - char[][] definedTypeNames = new char[typeNames.size()][]; // can be empty when no types are defined - typeNames.toArray(definedTypeNames); - references.put(typeLocator, new AdditionalTypeCollection(definedTypeNames, qualifiedRefs, simpleRefs)); - } - } - - void recordLocatorForType(String qualifiedTypeName, String typeLocator) { - this.knownPackageNames = null; - typeLocators.put(qualifiedTypeName, typeLocator); - } +// char[][] getDefinedTypeNamesFor(String typeLocator) { +// Object c = references.get(typeLocator); +// if (c instanceof AdditionalTypeCollection) +// return ((AdditionalTypeCollection) c).definedTypeNames; +// return null; // means only one type is defined with the same name as the file... saves space +// } + +// boolean isDuplicateLocator(String qualifiedTypeName, String typeLocator) { +// String existing = (String) typeLocators.get(qualifiedTypeName); +// return existing != null && !existing.equals(typeLocator); +// } + +// boolean isKnownPackage(String qualifiedPackageName) { +// if (knownPackageNames == null) { +// ArrayList names = new ArrayList(typeLocators.elementSize); +// Object[] keyTable = typeLocators.keyTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// String packageName = (String) keyTable[i]; // is a type name of the form p1/p2/A +// int last = packageName.lastIndexOf('/'); +// packageName = last == -1 ? null : packageName.substring(0, last); +// while (packageName != null && !names.contains(packageName)) { +// names.add(packageName); +// last = packageName.lastIndexOf('/'); +// packageName = last == -1 ? null : packageName.substring(0, last); +// } +// } +// } +// knownPackageNames = new String[names.size()]; +// names.toArray(knownPackageNames); +// } +// for (int i = 0, l = knownPackageNames.length; i < l; i++) +// if (knownPackageNames[i].equals(qualifiedPackageName)) +// return true; +// return false; +// } + +// void record(String typeLocator, char[][][] qualifiedRefs, char[][] simpleRefs, char[] mainTypeName, ArrayList typeNames) { +// if (typeNames.size() == 1 && CharOperation.equals(mainTypeName, (char[]) typeNames.get(0))) { +// references.put(typeLocator, new ReferenceCollection(qualifiedRefs, simpleRefs)); +// } else { +// char[][] definedTypeNames = new char[typeNames.size()][]; // can be empty when no types are defined +// typeNames.toArray(definedTypeNames); +// references.put(typeLocator, new AdditionalTypeCollection(definedTypeNames, qualifiedRefs, simpleRefs)); +// } +// } +// +// void recordLocatorForType(String qualifiedTypeName, String typeLocator) { +// this.knownPackageNames = null; +// typeLocators.put(qualifiedTypeName, typeLocator); +// } void recordStructuralDependency(IProject prereqProject, State prereqState) { if (prereqState != null) structuralBuildTimes.put(prereqProject.getName(), new Long(prereqState.lastStructuralBuildTime)); } - void removeLocator(String typeLocatorToRemove) { - this.knownPackageNames = null; - references.removeKey(typeLocatorToRemove); - typeLocators.removeValue(typeLocatorToRemove); - } +// void removeLocator(String typeLocatorToRemove) { +// this.knownPackageNames = null; +// references.removeKey(typeLocatorToRemove); +// typeLocators.removeValue(typeLocatorToRemove); +// } void removePackage(IResourceDelta sourceDelta) { IResource resource = sourceDelta.getResource(); @@ -166,15 +166,15 @@ public class State { return; case IResource.FILE : IPath typeLocatorPath = resource.getProjectRelativePath(); - if (Util.isJavaFileName(typeLocatorPath.lastSegment())) - removeLocator(typeLocatorPath.toString()); +// if (Util.isJavaFileName(typeLocatorPath.lastSegment())) +// removeLocator(typeLocatorPath.toString()); } } - void removeQualifiedTypeName(String qualifiedTypeNameToRemove) { - this.knownPackageNames = null; - typeLocators.removeKey(qualifiedTypeNameToRemove); - } +// void removeQualifiedTypeName(String qualifiedTypeNameToRemove) { +// this.knownPackageNames = null; +// typeLocators.removeKey(qualifiedTypeNameToRemove); +// } static State read(IProject project, DataInputStream in) throws IOException { if (PHPBuilder.DEBUG) @@ -194,9 +194,10 @@ public class State { } newState.buildNumber = in.readInt(); newState.lastStructuralBuildTime = in.readLong(); - - int length = in.readInt(); - newState.sourceLocations = new ClasspathMultiDirectory[0]; + + int length; +// int length = in.readInt(); +// newState.sourceLocations = new ClasspathMultiDirectory[0]; // newState.sourceLocations = new ClasspathMultiDirectory[length]; // for (int i = 0; i < length; i++) { // IContainer sourceFolder = project, outputFolder = project; @@ -210,7 +211,7 @@ public class State { // newState.sourceLocations[i] = md; // } - length = in.readInt(); +// length = in.readInt(); // newState.binaryLocations = new ClasspathLocation[length]; // IWorkspaceRoot root = project.getWorkspace().getRoot(); // for (int i = 0; i < length; i++) { @@ -237,51 +238,51 @@ public class State { for (int i = 0; i < length; i++) newState.structuralBuildTimes.put(in.readUTF(), new Long(in.readLong())); - String[] internedTypeLocators = new String[length = in.readInt()]; - for (int i = 0; i < length; i++) - internedTypeLocators[i] = in.readUTF(); - - newState.typeLocators = new SimpleLookupTable(length = in.readInt()); - for (int i = 0; i < length; i++) - newState.typeLocators.put(in.readUTF(), internedTypeLocators[in.readInt()]); - - char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(readNames(in), false); - char[][][] internedQualifiedNames = new char[length = in.readInt()][][]; - for (int i = 0; i < length; i++) { - int qLength = in.readInt(); - char[][] qName = new char[qLength][]; - for (int j = 0; j < qLength; j++) - qName[j] = internedSimpleNames[in.readInt()]; - internedQualifiedNames[i] = qName; - } - internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames); - - newState.references = new SimpleLookupTable(length = in.readInt()); - for (int i = 0; i < length; i++) { - String typeLocator = internedTypeLocators[in.readInt()]; - ReferenceCollection collection = null; - switch (in.readByte()) { - case 1 : - char[][] additionalTypeNames = readNames(in); - char[][][] qualifiedNames = new char[in.readInt()][][]; - for (int j = 0, m = qualifiedNames.length; j < m; j++) - qualifiedNames[j] = internedQualifiedNames[in.readInt()]; - char[][] simpleNames = new char[in.readInt()][]; - for (int j = 0, m = simpleNames.length; j < m; j++) - simpleNames[j] = internedSimpleNames[in.readInt()]; - collection = new AdditionalTypeCollection(additionalTypeNames, qualifiedNames, simpleNames); - break; - case 2 : - char[][][] qNames = new char[in.readInt()][][]; - for (int j = 0, m = qNames.length; j < m; j++) - qNames[j] = internedQualifiedNames[in.readInt()]; - char[][] sNames = new char[in.readInt()][]; - for (int j = 0, m = sNames.length; j < m; j++) - sNames[j] = internedSimpleNames[in.readInt()]; - collection = new ReferenceCollection(qNames, sNames); - } - newState.references.put(typeLocator, collection); - } +// String[] internedTypeLocators = new String[length = in.readInt()]; +// for (int i = 0; i < length; i++) +// internedTypeLocators[i] = in.readUTF(); + +// newState.typeLocators = new SimpleLookupTable(length = in.readInt()); +// for (int i = 0; i < length; i++) +// newState.typeLocators.put(in.readUTF(), internedTypeLocators[in.readInt()]); + +// char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(readNames(in), false); +// char[][][] internedQualifiedNames = new char[length = in.readInt()][][]; +// for (int i = 0; i < length; i++) { +// int qLength = in.readInt(); +// char[][] qName = new char[qLength][]; +// for (int j = 0; j < qLength; j++) +// qName[j] = internedSimpleNames[in.readInt()]; +// internedQualifiedNames[i] = qName; +// } +// internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames); +// +// newState.references = new SimpleLookupTable(length = in.readInt()); +// for (int i = 0; i < length; i++) { +// String typeLocator = internedTypeLocators[in.readInt()]; +// ReferenceCollection collection = null; +// switch (in.readByte()) { +// case 1 : +// char[][] additionalTypeNames = readNames(in); +// char[][][] qualifiedNames = new char[in.readInt()][][]; +// for (int j = 0, m = qualifiedNames.length; j < m; j++) +// qualifiedNames[j] = internedQualifiedNames[in.readInt()]; +// char[][] simpleNames = new char[in.readInt()][]; +// for (int j = 0, m = simpleNames.length; j < m; j++) +// simpleNames[j] = internedSimpleNames[in.readInt()]; +// collection = new AdditionalTypeCollection(additionalTypeNames, qualifiedNames, simpleNames); +// break; +// case 2 : +// char[][][] qNames = new char[in.readInt()][][]; +// for (int j = 0, m = qNames.length; j < m; j++) +// qNames[j] = internedQualifiedNames[in.readInt()]; +// char[][] sNames = new char[in.readInt()][]; +// for (int j = 0, m = sNames.length; j < m; j++) +// sNames[j] = internedSimpleNames[in.readInt()]; +// collection = new ReferenceCollection(qNames, sNames); +// } +// newState.references.put(typeLocator, collection); +// } if (PHPBuilder.DEBUG) System.out.println("Successfully read state for " + newState.javaProjectName); //$NON-NLS-1$ return newState; @@ -338,14 +339,14 @@ public class State { /* * ClasspathMultiDirectory[] int id String path(s) */ - out.writeInt(length = sourceLocations.length); - for (int i = 0; i < length; i++) { - ClasspathMultiDirectory md = sourceLocations[i]; - out.writeUTF(md.sourceFolder.getProjectRelativePath().toString()); - out.writeUTF(md.binaryFolder.getProjectRelativePath().toString()); - writeNames(md.exclusionPatterns, out); - out.writeBoolean(md.hasIndependentOutputFolder); - } +// out.writeInt(length = sourceLocations.length); +// for (int i = 0; i < length; i++) { +// ClasspathMultiDirectory md = sourceLocations[i]; +// out.writeUTF(md.sourceFolder.getProjectRelativePath().toString()); +// out.writeUTF(md.binaryFolder.getProjectRelativePath().toString()); +// writeNames(md.exclusionPatterns, out); +// out.writeBoolean(md.hasIndependentOutputFolder); +// } /* * ClasspathLocation[] int id String path(s) @@ -399,115 +400,115 @@ public class State { /* * String[] Interned type locators */ - out.writeInt(length = references.elementSize); - ArrayList internedTypeLocators = new ArrayList(length); - if (length > 0) { - keyTable = references.keyTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - length--; - String key = (String) keyTable[i]; - out.writeUTF(key); - internedTypeLocators.add(key); - } - } - if (PHPBuilder.DEBUG && length != 0) - System.out.println("references table is inconsistent"); //$NON-NLS-1$ - } +// out.writeInt(length = references.elementSize); +// ArrayList internedTypeLocators = new ArrayList(length); +// if (length > 0) { +// keyTable = references.keyTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// length--; +// String key = (String) keyTable[i]; +// out.writeUTF(key); +// internedTypeLocators.add(key); +// } +// } +// if (PHPBuilder.DEBUG && length != 0) +// System.out.println("references table is inconsistent"); //$NON-NLS-1$ +// } /* * Type locators table String type name int interned locator id */ - out.writeInt(length = typeLocators.elementSize); - if (length > 0) { - keyTable = typeLocators.keyTable; - valueTable = typeLocators.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - length--; - out.writeUTF((String) keyTable[i]); - out.writeInt(internedTypeLocators.indexOf((String) valueTable[i])); - } - } - if (PHPBuilder.DEBUG && length != 0) - System.out.println("typeLocators table is inconsistent"); //$NON-NLS-1$ - } +// out.writeInt(length = typeLocators.elementSize); +// if (length > 0) { +// keyTable = typeLocators.keyTable; +// valueTable = typeLocators.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// length--; +// out.writeUTF((String) keyTable[i]); +// out.writeInt(internedTypeLocators.indexOf((String) valueTable[i])); +// } +// } +// if (PHPBuilder.DEBUG && length != 0) +// System.out.println("typeLocators table is inconsistent"); //$NON-NLS-1$ +// } /* * char[][][] Interned qualified names char[][] Interned simple names */ - ArrayList internedQualifiedNames = new ArrayList(31); - ArrayList internedSimpleNames = new ArrayList(31); - valueTable = references.valueTable; - for (int i = 0, l = valueTable.length; i < l; i++) { - if (valueTable[i] != null) { - ReferenceCollection collection = (ReferenceCollection) valueTable[i]; - char[][][] qNames = collection.qualifiedNameReferences; - for (int j = 0, m = qNames.length; j < m; j++) { - char[][] qName = qNames[j]; - if (!internedQualifiedNames.contains(qName)) { // remember the names have been interned - internedQualifiedNames.add(qName); - for (int k = 0, n = qName.length; k < n; k++) { - char[] sName = qName[k]; - if (!internedSimpleNames.contains(sName)) // remember the names have been interned - internedSimpleNames.add(sName); - } - } - } - char[][] sNames = collection.simpleNameReferences; - for (int j = 0, m = sNames.length; j < m; j++) { - char[] sName = sNames[j]; - if (!internedSimpleNames.contains(sName)) // remember the names have been interned - internedSimpleNames.add(sName); - } - } - } - char[][] internedArray = new char[internedSimpleNames.size()][]; - internedSimpleNames.toArray(internedArray); - writeNames(internedArray, out); - // now write the interned qualified names as arrays of interned simple names - out.writeInt(length = internedQualifiedNames.size()); - for (int i = 0; i < length; i++) { - char[][] qName = (char[][]) internedQualifiedNames.get(i); - int qLength = qName.length; - out.writeInt(qLength); - for (int j = 0; j < qLength; j++) - out.writeInt(internedSimpleNames.indexOf(qName[j])); - } - - /* - * References table int interned locator id ReferenceCollection - */ - out.writeInt(length = references.elementSize); - if (length > 0) { - keyTable = references.keyTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - length--; - out.writeInt(internedTypeLocators.indexOf((String) keyTable[i])); - ReferenceCollection collection = (ReferenceCollection) valueTable[i]; - if (collection instanceof AdditionalTypeCollection) { - out.writeByte(1); - AdditionalTypeCollection atc = (AdditionalTypeCollection) collection; - writeNames(atc.definedTypeNames, out); - } else { - out.writeByte(2); - } - char[][][] qNames = collection.qualifiedNameReferences; - int qLength = qNames.length; - out.writeInt(qLength); - for (int j = 0; j < qLength; j++) - out.writeInt(internedQualifiedNames.indexOf(qNames[j])); - char[][] sNames = collection.simpleNameReferences; - int sLength = sNames.length; - out.writeInt(sLength); - for (int j = 0; j < sLength; j++) - out.writeInt(internedSimpleNames.indexOf(sNames[j])); - } - } - if (PHPBuilder.DEBUG && length != 0) - System.out.println("references table is inconsistent"); //$NON-NLS-1$ - } +// ArrayList internedQualifiedNames = new ArrayList(31); +// ArrayList internedSimpleNames = new ArrayList(31); +// valueTable = references.valueTable; +// for (int i = 0, l = valueTable.length; i < l; i++) { +// if (valueTable[i] != null) { +// ReferenceCollection collection = (ReferenceCollection) valueTable[i]; +// char[][][] qNames = collection.qualifiedNameReferences; +// for (int j = 0, m = qNames.length; j < m; j++) { +// char[][] qName = qNames[j]; +// if (!internedQualifiedNames.contains(qName)) { // remember the names have been interned +// internedQualifiedNames.add(qName); +// for (int k = 0, n = qName.length; k < n; k++) { +// char[] sName = qName[k]; +// if (!internedSimpleNames.contains(sName)) // remember the names have been interned +// internedSimpleNames.add(sName); +// } +// } +// } +// char[][] sNames = collection.simpleNameReferences; +// for (int j = 0, m = sNames.length; j < m; j++) { +// char[] sName = sNames[j]; +// if (!internedSimpleNames.contains(sName)) // remember the names have been interned +// internedSimpleNames.add(sName); +// } +// } +// } +// char[][] internedArray = new char[internedSimpleNames.size()][]; +// internedSimpleNames.toArray(internedArray); +// writeNames(internedArray, out); +// // now write the interned qualified names as arrays of interned simple names +// out.writeInt(length = internedQualifiedNames.size()); +// for (int i = 0; i < length; i++) { +// char[][] qName = (char[][]) internedQualifiedNames.get(i); +// int qLength = qName.length; +// out.writeInt(qLength); +// for (int j = 0; j < qLength; j++) +// out.writeInt(internedSimpleNames.indexOf(qName[j])); +// } +// +// /* +// * References table int interned locator id ReferenceCollection +// */ +// out.writeInt(length = references.elementSize); +// if (length > 0) { +// keyTable = references.keyTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// length--; +// out.writeInt(internedTypeLocators.indexOf((String) keyTable[i])); +// ReferenceCollection collection = (ReferenceCollection) valueTable[i]; +// if (collection instanceof AdditionalTypeCollection) { +// out.writeByte(1); +// AdditionalTypeCollection atc = (AdditionalTypeCollection) collection; +// writeNames(atc.definedTypeNames, out); +// } else { +// out.writeByte(2); +// } +// char[][][] qNames = collection.qualifiedNameReferences; +// int qLength = qNames.length; +// out.writeInt(qLength); +// for (int j = 0; j < qLength; j++) +// out.writeInt(internedQualifiedNames.indexOf(qNames[j])); +// char[][] sNames = collection.simpleNameReferences; +// int sLength = sNames.length; +// out.writeInt(sLength); +// for (int j = 0; j < sLength; j++) +// out.writeInt(internedSimpleNames.indexOf(sNames[j])); +// } +// } +// if (PHPBuilder.DEBUG && length != 0) +// System.out.println("references table is inconsistent"); //$NON-NLS-1$ +// } } private void writeNames(char[][] names, DataOutputStream out) throws IOException { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java index f1faf41..0ee24f0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java @@ -13,6 +13,7 @@ package net.sourceforge.phpdt.internal.core.jdom; import java.util.ArrayList; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit; import net.sourceforge.phpdt.core.jdom.IDOMField; @@ -27,7 +28,6 @@ import net.sourceforge.phpdt.internal.compiler.IDocumentElementRequestor; import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; import net.sourceforge.phpdt.internal.core.util.CharArrayOps; -import net.sourceforge.phpeclipse.PHPCore; /** * The DOMBuilder constructs each type of JDOM document fragment, @@ -56,7 +56,7 @@ public class DOMBuilder extends AbstractDOMBuilder implements IDocumentElementRe */ protected ArrayList fFields; - Map options = PHPCore.getOptions(); + Map options = JavaCore.getOptions(); /** * Creates a new DOMBuilder diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java index c923015..df63d2c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java @@ -12,13 +12,13 @@ package net.sourceforge.phpdt.internal.core.jdom; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit; import net.sourceforge.phpdt.internal.compiler.ISourceElementRequestor; import net.sourceforge.phpdt.internal.compiler.SourceElementParser; import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; import net.sourceforge.phpdt.internal.core.util.CharArrayOps; -import net.sourceforge.phpeclipse.PHPCore; /** * A DOM builder that uses the SourceElementParser @@ -51,7 +51,7 @@ public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name) */ public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) { initializeBuild(compilationUnit.getContents(), true, true); - getParser(PHPCore.getOptions()).parseCompilationUnit(compilationUnit, false); + getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false); return super.createCompilationUnit(compilationUnit); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java index 7c4ae96..a062bba 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java @@ -12,7 +12,7 @@ package net.sourceforge.phpdt.internal.ui.actions; import java.lang.reflect.InvocationTargetException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; @@ -39,7 +39,7 @@ public class WorkbenchRunnableAdapter implements IRunnableWithProgress { */ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { - PHPCore.run(fWorkspaceRunnable, monitor); + JavaCore.run(fWorkspaceRunnable, monitor); } catch (OperationCanceledException e) { throw new InterruptedException(e.getMessage()); } catch (CoreException e) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java index 2f7e150..ab22fb0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java @@ -11,12 +11,12 @@ import java.util.ArrayList; import java.util.Hashtable; import net.sourceforge.phpdt.core.ICodeFormatter; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.ToolFactory; import net.sourceforge.phpdt.internal.ui.PHPUIMessages; import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo; import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil; import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.runtime.IStatus; @@ -46,28 +46,28 @@ import org.eclipse.ui.IWorkbenchPreferencePage; public class CodeFormatterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { // Preference store keys, see PHPCore.getOptions - private static final String PREF_NEWLINE_OPENING_BRACES= PHPCore.FORMATTER_NEWLINE_OPENING_BRACE; - private static final String PREF_NEWLINE_CONTROL_STATEMENT= PHPCore.FORMATTER_NEWLINE_CONTROL; - private static final String PREF_NEWLINE_CLEAR_ALL= PHPCore.FORMATTER_CLEAR_BLANK_LINES; + private static final String PREF_NEWLINE_OPENING_BRACES= JavaCore.FORMATTER_NEWLINE_OPENING_BRACE; + private static final String PREF_NEWLINE_CONTROL_STATEMENT= JavaCore.FORMATTER_NEWLINE_CONTROL; + private static final String PREF_NEWLINE_CLEAR_ALL= JavaCore.FORMATTER_CLEAR_BLANK_LINES; // private static final String PREF_NEWLINE_ELSE_IF= PHPCore.FORMATTER_NEWLINE_ELSE_IF; - private static final String PREF_NEWLINE_EMPTY_BLOCK= PHPCore.FORMATTER_NEWLINE_EMPTY_BLOCK; - private static final String PREF_LINE_SPLIT= PHPCore.FORMATTER_LINE_SPLIT; - private static final String PREF_STYLE_COMPACT_ASSIGNEMENT= PHPCore.FORMATTER_COMPACT_ASSIGNMENT; - private static final String PREF_TAB_CHAR= PHPCore.FORMATTER_TAB_CHAR; - private static final String PREF_TAB_SIZE= PHPCore.FORMATTER_TAB_SIZE; + private static final String PREF_NEWLINE_EMPTY_BLOCK= JavaCore.FORMATTER_NEWLINE_EMPTY_BLOCK; + private static final String PREF_LINE_SPLIT= JavaCore.FORMATTER_LINE_SPLIT; + private static final String PREF_STYLE_COMPACT_ASSIGNEMENT= JavaCore.FORMATTER_COMPACT_ASSIGNMENT; + private static final String PREF_TAB_CHAR= JavaCore.FORMATTER_TAB_CHAR; + private static final String PREF_TAB_SIZE= JavaCore.FORMATTER_TAB_SIZE; // values - private static final String INSERT= PHPCore.INSERT; - private static final String DO_NOT_INSERT= PHPCore.DO_NOT_INSERT; + private static final String INSERT= JavaCore.INSERT; + private static final String DO_NOT_INSERT= JavaCore.DO_NOT_INSERT; - private static final String COMPACT= PHPCore.COMPACT; - private static final String NORMAL= PHPCore.NORMAL; + private static final String COMPACT= JavaCore.COMPACT; + private static final String NORMAL= JavaCore.NORMAL; - private static final String TAB= PHPCore.TAB; - private static final String SPACE= PHPCore.SPACE; + private static final String TAB= JavaCore.TAB; + private static final String SPACE= JavaCore.SPACE; - private static final String CLEAR_ALL= PHPCore.CLEAR_ALL; - private static final String PRESERVE_ONE= PHPCore.PRESERVE_ONE; + private static final String CLEAR_ALL= JavaCore.CLEAR_ALL; + private static final String PRESERVE_ONE= JavaCore.PRESERVE_ONE; private static String[] getAllKeys() { @@ -84,7 +84,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static int getTabSize() { - String string= (String) PHPCore.getOptions().get(PREF_TAB_SIZE); + String string= (String) JavaCore.getOptions().get(PREF_TAB_SIZE); return getPositiveIntValue(string, 4); } @@ -93,7 +93,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static boolean isCompactingAssignment() { - return COMPACT.equals(PHPCore.getOptions().get(PREF_STYLE_COMPACT_ASSIGNEMENT)); + return COMPACT.equals(JavaCore.getOptions().get(PREF_STYLE_COMPACT_ASSIGNEMENT)); } /** @@ -101,7 +101,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static boolean useSpaces() { - return SPACE.equals(PHPCore.getOptions().get(PREF_TAB_CHAR)); + return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR)); } @@ -167,7 +167,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); setDescription(PHPUIMessages.getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$ - fWorkingValues= PHPCore.getOptions(); + fWorkingValues= JavaCore.getOptions(); fCheckBoxes= new ArrayList(); fTextBoxes= new ArrayList(); @@ -385,13 +385,13 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork String[] allKeys= getAllKeys(); // preserve other options // store in JCore - Hashtable actualOptions= PHPCore.getOptions(); + Hashtable actualOptions= JavaCore.getOptions(); for (int i= 0; i < allKeys.length; i++) { String key= allKeys[i]; String val= (String) fWorkingValues.get(key); actualOptions.put(key, val); } - PHPCore.setOptions(actualOptions); + JavaCore.setOptions(actualOptions); PHPeclipsePlugin.getDefault().savePluginPreferences(); return super.performOk(); } @@ -400,7 +400,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @see PreferencePage#performDefaults() */ protected void performDefaults() { - fWorkingValues= PHPCore.getDefaultOptions(); + fWorkingValues= JavaCore.getDefaultOptions(); updateControls(); super.performDefaults(); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java index 641374d..c273cfe 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.PHPUIMessages; import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo; import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil; @@ -26,7 +27,6 @@ import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; import net.sourceforge.phpeclipse.IPreferenceConstants; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration; import net.sourceforge.phpeclipse.preferences.ColorEditor; @@ -76,7 +76,7 @@ import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX; - private static final String COMPILER_TASK_TAGS = PHPCore.COMPILER_TASK_TAGS; + private static final String COMPILER_TASK_TAGS = JavaCore.COMPILER_TASK_TAGS; public final OverlayPreferenceStore.OverlayKey[] fKeys = new OverlayPreferenceStore.OverlayKey[] { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java index 6199901..c52aeb5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java @@ -1,7 +1,7 @@ package net.sourceforge.phpdt.internal.ui.util; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.dialog.ElementListSelectionDialog; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IProject; @@ -28,7 +28,7 @@ public class PHPProjectSelector extends ResourceSelector { ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new WorkbenchLabelProvider()); dialog.setTitle(browseDialogTitle); dialog.setMessage(browseDialogMessage); - dialog.setElements(PHPCore.getPHPProjects()); + dialog.setElements(JavaCore.getPHPProjects()); if (dialog.open() == ElementListSelectionDialog.OK) { textField.setText(((IProject) dialog.getFirstResult()).getName()); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java index 23ff50e..3120edf 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java @@ -14,7 +14,7 @@ import net.sourceforge.phpdt.core.IBufferFactory; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.EditorUtility; import net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider; @@ -556,7 +556,7 @@ public final class JavaUI { * @since 2.0 */ public static IWorkingCopy[] getSharedWorkingCopies() { - return PHPCore.getSharedWorkingCopies(getBufferFactory()); + return JavaCore.getSharedWorkingCopies(getBufferFactory()); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java index 21b7dc1..7f1d21b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java @@ -23,8 +23,8 @@ import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IParent; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; @@ -318,7 +318,7 @@ public class StandardJavaElementContentProvider implements ITreeContentProvider, // Included is a member of excluded, but since it is rendered as a source // folder we have to exclude it as a normal child. if (o instanceof IFolder) { - IJavaElement element= PHPCore.create((IFolder)o); + IJavaElement element= JavaCore.create((IFolder)o); if (element instanceof IPackageFragmentRoot && element.exists()) { continue; } @@ -408,7 +408,7 @@ public class StandardJavaElementContentProvider implements ITreeContentProvider, // try to map resources to the containing package fragment if (element instanceof IResource) { IResource parent= ((IResource)element).getParent(); - IJavaElement jParent= PHPCore.create(parent); + IJavaElement jParent= JavaCore.create(parent); // http://bugs.eclipse.org/bugs/show_bug.cgi?id=31374 if (jParent != null && jParent.exists()) return jParent; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java index 7dddc0f..735c2a7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java @@ -14,6 +14,7 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.externaltools.internal.ui.StatusInfo; import net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider; import net.sourceforge.phpdt.internal.ui.wizards.NewWizardMessages; @@ -22,7 +23,6 @@ import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.IDialogFieldListen import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.IStringButtonAdapter; import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.LayoutUtil; import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.StringButtonDialogField; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IProject; @@ -141,7 +141,7 @@ public abstract class NewContainerWizardPage extends NewElementWizardPage { jelem= (IJavaElement) resource.getAdapter(IJavaElement.class); } if (jelem == null) { - jelem= PHPCore.create(resource); // java project + jelem= JavaCore.create(resource); // java project } } } @@ -163,7 +163,7 @@ public abstract class NewContainerWizardPage extends NewElementWizardPage { if (jelem == null || jelem.getElementType() == IJavaElement.JAVA_MODEL) { try { - IJavaProject[] projects= PHPCore.create(getWorkspaceRoot()).getJavaProjects(); + IJavaProject[] projects= JavaCore.create(getWorkspaceRoot()).getJavaProjects(); if (projects.length == 1) { jelem= projects[0]; } @@ -270,7 +270,7 @@ public abstract class NewContainerWizardPage extends NewElementWizardPage { status.setError(NewWizardMessages.getFormattedString("NewContainerWizardPage.error.ProjectClosed", proj.getFullPath().toString())); //$NON-NLS-1$ return status; } - IJavaProject jproject= PHPCore.create(proj); + IJavaProject jproject= JavaCore.create(proj); // fCurrRoot= jproject.getPackageFragmentRoot(res); // if (res.exists()) { // try { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java deleted file mode 100644 index aff160f..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java +++ /dev/null @@ -1,3780 +0,0 @@ -package net.sourceforge.phpeclipse; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import net.sourceforge.phpdt.core.ClasspathVariableInitializer; -import net.sourceforge.phpdt.core.ElementChangedEvent; -import net.sourceforge.phpdt.core.IBufferFactory; -import net.sourceforge.phpdt.core.IClasspathEntry; -import net.sourceforge.phpdt.core.ICompilationUnit; -import net.sourceforge.phpdt.core.IElementChangedListener; -import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.IJavaModel; -import net.sourceforge.phpdt.core.IJavaProject; -import net.sourceforge.phpdt.core.IMember; -import net.sourceforge.phpdt.core.IPackageFragmentRoot; -import net.sourceforge.phpdt.core.IRegion; -import net.sourceforge.phpdt.core.IWorkingCopy; -import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.internal.core.BatchOperation; -import net.sourceforge.phpdt.internal.core.BufferManager; -import net.sourceforge.phpdt.internal.core.ClasspathEntry; -import net.sourceforge.phpdt.internal.core.JavaModel; -import net.sourceforge.phpdt.internal.core.JavaModelManager; -import net.sourceforge.phpdt.internal.core.Region; -import net.sourceforge.phpdt.internal.corext.Assert; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IMarkerDelta; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; - -public class PHPCore { - -// public static HashSet OptionNames = new HashSet(20); - /** - * The plug-in identifier of the Java core support - * (value "org.phpeclipse.phpdt.core"). - */ -// public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core"; //$NON-NLS-1$ - public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID; - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$ - - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String INSERT = "insert"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$ - - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String NORMAL = "normal"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPACT = "compact"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String TAB = "tab"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String SPACE = "space"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ENABLED = "enabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DISABLED = "disabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CLEAN = "clean"; //$NON-NLS-1$ - - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ - - /** - * Name of the handle id attribute in a Java marker. - */ - protected static final String ATT_HANDLE_ID = - "net.sourceforge.phpdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$ - - // *************** Possible IDs for configurable options. ******************** - - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$ - /** - * Default task tag - * @since 2.1 - */ - public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ - /** - * Default task priority - * @since 2.1 - */ - public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$ - - // *************** Possible values for configurable options. ******************** - - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String GENERATE = "generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String PRESERVE = "preserve"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ABORT = "abort"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String ERROR = "error"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String WARNING = "warning"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String IGNORE = "ignore"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String COMPUTE = "compute"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - - - /** - * Returns a table of all known configurable options with their default values. - * These options allow to configure the behaviour of the underlying components. - * The client may safely use the result as a template that they can modify and - * then pass to setOptions. - * - * Helper constants have been defined on JavaCore for each of the option ID and - * their possible constant values. - * - * Note: more options might be added in further releases. - *

-   * RECOGNIZED OPTIONS:
-   * COMPILER / Generating Local Variable Debug Attribute
-   *    When generated, this attribute will enable local variable names 
-   *    to be displayed in debugger, only in place where variables are 
-   *    definitely assigned (.class file is then bigger)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
-   *     - possible values:   { "generate", "do not generate" }
-   *     - default:           "generate"
-   *
-   * COMPILER / Generating Line Number Debug Attribute 
-   *    When generated, this attribute will enable source code highlighting in debugger 
-   *    (.class file is then bigger).
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
-   *     - possible values:   { "generate", "do not generate" }
-   *     - default:           "generate"
-   *    
-   * COMPILER / Generating Source Debug Attribute 
-   *    When generated, this attribute will enable the debugger to present the 
-   *    corresponding source code.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
-   *     - possible values:   { "generate", "do not generate" }
-   *     - default:           "generate"
-   *    
-   * COMPILER / Preserving Unused Local Variables
-   *    Unless requested to preserve unused local variables (i.e. never read), the 
-   *    compiler will optimize them out, potentially altering debugging
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
-   *     - possible values:   { "preserve", "optimize out" }
-   *     - default:           "preserve"
-   * 
-   * COMPILER / Defining Target Java Platform
-   *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
-   *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
-   *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
-   *     - default:           "1.1"
-   *
-   * COMPILER / Reporting Unreachable Code
-   *    Unreachable code can optionally be reported as an error, warning or simply 
-   *    ignored. The bytecode generation will always optimized it out.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "error"
-   *
-   * COMPILER / Reporting Invalid Import
-   *    An import statement that cannot be resolved might optionally be reported 
-   *    as an error, as a warning or ignored.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "error"
-   *
-   * COMPILER / Reporting Attempt to Override Package-Default Method
-   *    A package default method is not visible in a different package, and thus 
-   *    cannot be overridden. When enabling this option, the compiler will signal 
-   *    such scenarii either as an error or a warning.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Method With Constructor Name
-   *    Naming a method with a constructor name is generally considered poor 
-   *    style programming. When enabling this option, the compiler will signal such 
-   *    scenarii either as an error or a warning.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Deprecation
-   *    When enabled, the compiler will signal use of deprecated API either as an 
-   *    error or a warning.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Deprecation Inside Deprecated Code
-   *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
-   *    The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
-   *     - possible values:   { "enabled", "disabled" }
-   *     - default:           "disabled"
-   *
-   * COMPILER / Reporting Hidden Catch Block
-   *    Locally to a try statement, some catch blocks may hide others , e.g.
-   *      try {  throw new java.io.CharConversionException();
-   *      } catch (java.io.CharConversionException e) {
-   *      } catch (java.io.IOException e) {}. 
-   *    When enabling this option, the compiler will issue an error or a warning for hidden 
-   *    catch blocks corresponding to checked exceptions
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Unused Local
-   *    When enabled, the compiler will issue an error or a warning for unused local 
-   *    variables (i.e. variables never read from)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   *
-   * COMPILER / Reporting Unused Parameter
-   *    When enabled, the compiler will issue an error or a warning for unused method 
-   *    parameters (i.e. parameters never read from)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   *
-   * COMPILER / Reporting Unused Import
-   *    When enabled, the compiler will issue an error or a warning for unused import 
-   *    reference 
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Synthetic Access Emulation
-   *    When enabled, the compiler will issue an error or a warning whenever it emulates 
-   *    access to a non-accessible member of an enclosing type. Such access can have
-   *    performance implications.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   *
-   * COMPILER / Reporting Non-Externalized String Literal
-   *    When enabled, the compiler will issue an error or a warning for non externalized 
-   *    String literal (i.e. non tagged with //$NON-NLS-$). 
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   * 
-   * COMPILER / Reporting Usage of 'assert' Identifier
-   *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
-   *    used as an identifier (reserved keyword in 1.4)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   * 
-   * COMPILER / Reporting Usage of expression receiver on static invocation/field access
-   *    When enabled, the compiler will issue an error or a warning whenever a static field
-   *    or method is accessed with an expression receiver.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   * 
-   * COMPILER / Reporting Assignment with no effect
-   *    When enabled, the compiler will issue an error or a warning whenever an assignment
-   *    has no effect (e.g 'x = x').
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   * 
-   * COMPILER / Setting Source Compatibility Mode
-   *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
-   *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
-   *   level should be set to "1.4" and the compliance mode should be "1.4".
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.source"
-   *     - possible values:   { "1.3", "1.4" }
-   *     - default:           "1.3"
-   * 
-   * COMPILER / Setting Compliance Level
-   *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
-   *    should not go beyond "1.3" level.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.compliance"
-   *     - possible values:   { "1.3", "1.4" }
-   *     - default:           "1.3"
-   * 
-   * COMPILER / Maximum number of problems reported per compilation unit
-   *    Specify the maximum number of problems reported on each compilation unit.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
-   *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
-   *     - default:           "100"
-   * 
-   * COMPILER / Define the Automatic Task Tags
-   *    When the tag is non empty, the compiler will issue a task marker whenever it encounters
-   *    one of the corresponding tag inside any comment in Java source code.
-   *    Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskTags"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * COMPILER / Define the Automatic Task Priorities
-   *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
-   *    of the task markers issued by the compiler.
-   *    If the default is specified, the priority of each task marker is "NORMAL".
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskPriorities"
-   *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
-   *     - default:           ""
-   * 
-   * BUILDER / Specifying Filters for Resource Copying Control
-   *    Allow to specify some filters to control the resource copy process.
-   *     - option id:         "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
-   *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
-   *       or the name of a folder which ends with '/'
-   *     - default:           ""
-   * 
-   * BUILDER / Abort if Invalid Classpath
-   *    Allow to toggle the builder to abort if the classpath is invalid
-   *     - option id:         "org.phpeclipse.phpdt.core.builder.invalidClasspath"
-   *     - possible values:   { "abort", "ignore" }
-   *     - default:           "ignore"
-   * 
-   * BUILDER / Cleaning Output Folder(s)
-   *    Indicate whether the JavaBuilder is allowed to clean the output folders
-   *    when performing full build operations.
-   *     - option id:         "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
-   *     - possible values:   { "clean", "ignore" }
-   *     - default:           "clean"
-   * 
-   * JAVACORE / Computing Project Build Order
-   *    Indicate whether JavaCore should enforce the project build order to be based on
-   *    the classpath prerequisite chain. When requesting to compute, this takes over
-   *    the platform default order (based on project references).
-   *     - option id:         "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
-   *     - possible values:   { "compute", "ignore" }
-   *     - default:           "ignore"	 
-   * 
-   * JAVACORE / Specify Default Source Encoding Format
-   *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
-   *    to 'ResourcesPlugin.getEncoding()'.
-   *     - option id:         "org.phpeclipse.phpdt.core.encoding"
-   *     - possible values:   { any of the supported encoding name}.
-   *     - default:           
-   * 
-   * JAVACORE / Reporting Incomplete Classpath
-   *    An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
-   *     - option id:         "org.phpeclipse.phpdt.core.incompleteClasspath"
-   *     - possible values:   { "error", "warning"}
-   *     - default:           "error"
-   * 
-   * JAVACORE / Reporting Classpath Cycle
-   *    A project is involved in a cycle.
-   *     - option id:         "org.phpeclipse.phpdt.core.circularClasspath"
-   *     - possible values:   { "error", "warning" }
-   *     - default:           "error"
-   * 
-   *	FORMATTER / Inserting New Line Before Opening Brace
-   *    When Insert, a new line is inserted before an opening brace, otherwise nothing
-   *    is inserted
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "do not insert"
-   * 
-   *	FORMATTER / Inserting New Line Inside Control Statement
-   *    When Insert, a new line is inserted between } and following else, catch, finally
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "do not insert"
-   * 
-   *	FORMATTER / Clearing Blank Lines
-   *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
-   *    and all others removed.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
-   *     - possible values:   { "clear all", "preserve one" }
-   *     - default:           "preserve one"
-   * 
-   *	FORMATTER / Inserting New Line Between Else/If 
-   *    When Insert, a blank line is inserted between an else and an if when they are 
-   *    contiguous. When choosing to not insert, else-if will be kept on the same
-   *    line when possible.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "do not insert"
-   * 
-   *	FORMATTER / Inserting New Line In Empty Block
-   *    When insert, a line break is inserted between contiguous { and }, if } is not followed
-   *    by a keyword.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "insert"
-   * 
-   *	FORMATTER / Splitting Lines Exceeding Length
-   *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
-   *    disable line splitting
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.lineSplit"
-   *     - possible values:	"", where n is zero or a positive integer
-   *     - default:           "80"
-   * 
-   *	FORMATTER / Compacting Assignment
-   *    Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
-   *    is inserted before the assignment operator
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.style.assignment"
-   *     - possible values:   { "compact", "normal" }
-   *     - default:           "normal"
-   * 
-   *	FORMATTER / Defining Indentation Character
-   *    Either choose to indent with tab characters or spaces
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.char"
-   *     - possible values:   { "tab", "space" }
-   *     - default:           "tab"
-   * 
-   *	FORMATTER / Defining Space Indentation Length
-   *    When using spaces, set the amount of space characters to use for each 
-   *    indentation mark.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.size"
-   *     - possible values:	"", where n is a positive integer
-   *     - default:           "4"
-   * 
-   *	CODEASSIST / Activate Visibility Sensitive Completion
-   *    When active, completion doesn't show that you can not see
-   *    (e.g. you can not see private methods of a super class).
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
-   *     - possible values:   { "enabled", "disabled" }
-   *     - default:           "disabled"
-   * 
-   *	CODEASSIST / Automatic Qualification of Implicit Members
-   *    When active, completion automatically qualifies completion on implicit
-   *    field references and message expressions.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
-   *     - possible values:   { "enabled", "disabled" }
-   *     - default:           "disabled"
-   * 
-   *  CODEASSIST / Define the Prefixes for Field Name
-   *    When the prefixes is non empty, completion for field name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Prefixes for Static Field Name
-   *    When the prefixes is non empty, completion for static field name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Prefixes for Local Variable Name
-   *    When the prefixes is non empty, completion for local variable name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Prefixes for Argument Name
-   *    When the prefixes is non empty, completion for argument name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Field Name
-   *    When the suffixes is non empty, completion for field name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Static Field Name
-   *    When the suffixes is non empty, completion for static field name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Local Variable Name
-   *    When the suffixes is non empty, completion for local variable name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Argument Name
-   *    When the suffixes is non empty, completion for argument name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
- * - * @return a mutable table containing the default settings of all known options - * (key type: String; value type: String) - * @see #setOptions - */ -// public static Hashtable getDefaultOptions() { -// -// Hashtable defaultOptions = new Hashtable(10); -// -// // see #initializeDefaultPluginPreferences() for changing default settings -// Preferences preferences = getPlugin().getPluginPreferences(); -// HashSet optionNames = OptionNames; -// -// // get preferences set to their default -// String[] defaultPropertyNames = preferences.defaultPropertyNames(); -// for (int i = 0; i < defaultPropertyNames.length; i++) { -// String propertyName = defaultPropertyNames[i]; -// if (optionNames.contains(propertyName)) { -// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); -// } -// } -// // get preferences not set to their default -// String[] propertyNames = preferences.propertyNames(); -// for (int i = 0; i < propertyNames.length; i++) { -// String propertyName = propertyNames[i]; -// if (optionNames.contains(propertyName)) { -// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); -// } -// } -// // get encoding through resource plugin -// defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); -// -// return defaultOptions; -// } - /** - * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) - * Note that it may answer null if this option does not exist. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param optionName the name of an option - * @return the String value of a given option - * @see JavaCore#getDefaultOptions - * @since 2.0 - */ -// public static String getOption(String optionName) { -// -// if (CORE_ENCODING.equals(optionName)) { -// return ResourcesPlugin.getEncoding(); -// } -// if (OptionNames.contains(optionName)) { -// Preferences preferences = getPlugin().getPluginPreferences(); -// return preferences.getString(optionName).trim(); -// } -// return null; -// } - - /** - * Returns the table of the current options. Initially, all options have their default values, - * and this method returns a table that includes all known options. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @return table of current settings of all options - * (key type: String; value type: String) - * @see JavaCore#getDefaultOptions - */ -// public static Hashtable getOptions() { -// -// Hashtable options = new Hashtable(10); -// -// // see #initializeDefaultPluginPreferences() for changing default settings -// Plugin plugin = getPlugin(); -// if (plugin != null) { -// Preferences preferences = getPlugin().getPluginPreferences(); -// HashSet optionNames = OptionNames; -// -// // get preferences set to their default -// String[] defaultPropertyNames = preferences.defaultPropertyNames(); -// for (int i = 0; i < defaultPropertyNames.length; i++) { -// String propertyName = defaultPropertyNames[i]; -// if (optionNames.contains(propertyName)) { -// options.put(propertyName, preferences.getDefaultString(propertyName)); -// } -// } -// // get preferences not set to their default -// String[] propertyNames = preferences.propertyNames(); -// for (int i = 0; i < propertyNames.length; i++) { -// String propertyName = propertyNames[i]; -// if (optionNames.contains(propertyName)) { -// options.put(propertyName, preferences.getString(propertyName).trim()); -// } -// } -// // get encoding through resource plugin -// options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); -// } -// return options; -// } - /** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param newOptions the new options (key type: String; value type: String), - * or null to reset all options to their default values - * @see JavaCore#getDefaultOptions - */ -// public static void setOptions(Hashtable newOptions) { -// -// // see #initializeDefaultPluginPreferences() for changing default settings -// Preferences preferences = getPlugin().getPluginPreferences(); -// -// if (newOptions == null) { -// newOptions = getDefaultOptions(); -// } -// Enumeration keys = newOptions.keys(); -// while (keys.hasMoreElements()) { -// String key = (String) keys.nextElement(); -// if (!OptionNames.contains(key)) -// continue; // unrecognized option -// if (key.equals(CORE_ENCODING)) -// continue; // skipped, contributed by resource prefs -// String value = (String) newOptions.get(key); -// preferences.setValue(key, value); -// } -// -// // persist options -// getPlugin().savePluginPreferences(); -// } - public static IProject[] getPHPProjects() { - List phpProjectsList = new ArrayList(); - IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace().getRoot().getProjects(); - - for (int i = 0; i < workspaceProjects.length; i++) { - IProject iProject = workspaceProjects[i]; - if (isPHPProject(iProject)) - phpProjectsList.add(iProject); - } - - IProject[] phpProjects = new IProject[phpProjectsList.size()]; - return (IProject[]) phpProjectsList.toArray(phpProjects); - } - -// public static PHPProject getPHPProject(String name) { -// IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(name); -// if (isPHPProject(aProject)) { -// PHPProject thePHPProject = new PHPProject(); -// thePHPProject.setProject(aProject); -// return thePHPProject; -// } -// return null; -// } - - public static boolean isPHPProject(IProject aProject) { - try { - return aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID); - } catch (CoreException e) { - } - - return false; - } - -// public static PHPFile create(IFile aFile) { -// if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// -// return null; -// } - -// public static PHPProject create(IProject aProject) { -// -// try { -// if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { -// PHPProject project = new PHPProject(); -// project.setProject(aProject); -// return project; -// } -// } catch (CoreException e) { -// System.err.println("Exception occurred in PHPCore#create(IProject): " + e.toString()); -// } -// -// return null; -// } - - public static void addPHPNature(IProject project, IProgressMonitor monitor) throws CoreException { - if (!project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { - IProjectDescription description = project.getDescription(); - String[] prevNatures = description.getNatureIds(); - String[] newNatures = new String[prevNatures.length + 1]; - System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); - newNatures[prevNatures.length] = PHPeclipsePlugin.PHP_NATURE_ID; - description.setNatureIds(newNatures); - project.setDescription(description, monitor); - } - } - - /** - * Returns the single instance of the PHP core plug-in runtime class. - * - * @return the single instance of the PHP core plug-in runtime class - */ - public static Plugin getPlugin() { - return PHPeclipsePlugin.getDefault(); - } - - /** - * Initializes the default preferences settings for this plug-in. - */ - - /** - * Runs the given action as an atomic Java model operation. - *

- * After running a method that modifies Java elements, - * registered listeners receive after-the-fact notification of - * what just transpired, in the form of a element changed event. - * This method allows clients to call a number of - * methods that modify java elements and only have element - * changed event notifications reported at the end of the entire - * batch. - *

- *

- * If this method is called outside the dynamic scope of another such - * call, this method runs the action and then reports a single - * element changed event describing the net effect of all changes - * done to java elements by the action. - *

- *

- * If this method is called in the dynamic scope of another such - * call, this method simply runs the action. - *

- * - * @param action the action to perform - * @param monitor a progress monitor, or null if progress - * reporting and cancellation are not desired - * @exception CoreException if the operation failed. - * @since 2.1 - */ - public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (workspace.isTreeLocked()) { - new BatchOperation(action).run(monitor); - } else { - // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode - workspace.run(new BatchOperation(action), monitor); - } - } - -/** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * - * This listener will only be notified during the POST_CHANGE resource change notification - * and any reconcile operation (POST_RECONCILE). - * For finer control of the notification, use addElementChangedListener(IElementChangedListener,int), - * which allows to specify a different eventMask. - * - * @see ElementChangedEvent - * @param listener the listener - */ -public static void addElementChangedListener(IElementChangedListener listener) { - addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); -} - -/** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * After completion of this method, the given listener will be registered for exactly - * the specified events. If they were previously registered for other events, they - * will be deregistered. - *

- * Once registered, a listener starts receiving notification of changes to - * java elements in the model. The listener continues to receive - * notifications until it is replaced or removed. - *

- *

- * Listeners can listen for several types of event as defined in ElementChangeEvent. - * Clients are free to register for any number of event types however if they register - * for more than one, it is their responsibility to ensure they correctly handle the - * case where the same java element change shows up in multiple notifications. - * Clients are guaranteed to receive only the events for which they are registered. - *

- * - * @param listener the listener - * @param eventMask the bit-wise OR of all event types of interest to the listener - * @see IElementChangedListener - * @see ElementChangedEvent - * @see #removeElementChangedListener(IElementChangedListener) - * @since 2.0 - */ -public static void addElementChangedListener(IElementChangedListener listener, int eventMask) { - JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask); -} - -/** - * Configures the given marker attribute map for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param attributes the mutable marker attribute map (key type: String, - * value type: String) - * @param element the Java element for which the marker needs to be configured - */ -public static void addJavaElementMarkerAttributes( - Map attributes, - IJavaElement element) { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (attributes != null && element != null) - attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); -} - -/** - * Configures the given marker for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param marker the marker to be configured - * @param element the Java element for which the marker needs to be configured - * @exception CoreException if the IMarker.setAttribute on the marker fails - */ -public void configureJavaElementMarker(IMarker marker, IJavaElement element) - throws CoreException { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (marker != null && element != null) - marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); -} - -/** - * Returns the Java model element corresponding to the given handle identifier - * generated by IJavaElement.getHandleIdentifier(), or - * null if unable to create the associated element. - */ -public static IJavaElement create(String handleIdentifier) { - if (handleIdentifier == null) { - return null; - } - try { - return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier); - } catch (JavaModelException e) { - return null; - } -} -/** - * Returns the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element. - * - *

The file must be one of:

    - *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • - *
  • a .class file - the element returned is the corresponding IClassFile
  • - *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • - *
- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given file - * @return the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element - */ -public static IJavaElement create(IFile file) { - return JavaModelManager.create(file, null); -} -/** - * Returns the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element. - *

- * Note that a package fragment root is returned rather than a default package. - *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given folder - * @return the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element - */ -public static IJavaElement create(IFolder folder) { - return JavaModelManager.create(folder, null); -} -/** - * Returns the Java project corresponding to the given project. - *

- * Creating a Java Project has the side effect of creating and opening all of the - * project's parents if they are not yet open. - *

- * Note that no check is done at this time on the existence or the java nature of this project. - * - * @param project the given project - * @return the Java project corresponding to the given project, null if the given project is null - */ -public static IJavaProject create(IProject project) { - if (project == null) { - return null; - } - JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel(); - return javaModel.getJavaProject(project); -} -/** - * Returns the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element. - *

- * The resource must be one of:

    - *
  • a project - the element returned is the corresponding IJavaProject
  • - *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • - *
  • a .class file - the element returned is the corresponding IClassFile
  • - *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • - *
  • a folder - the element returned is the corresponding IPackageFragmentRoot - * or IPackageFragment
  • - *
  • the workspace root resource - the element returned is the IJavaModel
  • - *
- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param resource the given resource - * @return the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element - */ -public static IJavaElement create(IResource resource) { - return JavaModelManager.create(resource, null); -} -/** - * Returns the Java model. - * - * @param root the given root - * @return the Java model, or null if the root is null - */ -public static IJavaModel create(IWorkspaceRoot root) { - if (root == null) { - return null; - } - return JavaModelManager.getJavaModelManager().getJavaModel(); -} -/** - * Creates and returns a class file element for - * the given .class file. Returns null if unable - * to recognize the class file. - * - * @param file the given .class file - * @return a class file element for the given .class file, or null if unable - * to recognize the class file - */ -//public static IClassFile createClassFileFrom(IFile file) { -// return JavaModelManager.createClassFileFrom(file, null); -//} -/** - * Creates and returns a compilation unit element for - * the given .java file. Returns null if unable - * to recognize the compilation unit. - * - * @param file the given .java file - * @return a compilation unit element for the given .java file, or null if unable - * to recognize the compilation unit - */ -public static ICompilationUnit createCompilationUnitFrom(IFile file) { - return JavaModelManager.createCompilationUnitFrom(file, null); -} -/** - * Creates and returns a handle for the given JAR file. - * The Java model associated with the JAR's project may be - * created as a side effect. - * - * @param file the given JAR file - * @return a handle for the given JAR file, or null if unable to create a JAR package fragment root. - * (for example, if the JAR file represents a non-Java resource) - */ -//public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) { -// return JavaModelManager.createJarPackageFragmentRootFrom(file, null); -//} - -/** - * Answers the project specific value for a given classpath container. - * In case this container path could not be resolved, then will answer null. - * Both the container path and the project context are supposed to be non-null. - *

- * The containerPath is a formed by a first ID segment followed with extra segments, which can be - * used as additional hints for resolution. If no container was ever recorded for this container path - * onto this project (using setClasspathContainer, then a - * ClasspathContainerInitializer will be activated if any was registered for this container - * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that the returned container must answer the exact same containerPath - * when requested IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * @param containerPath the name of the container, which needs to be resolved - * @param project a specific project in which the container is being resolved - * @return the corresponding classpath container or null if unable to find one. - * - * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container - * contains illegal entries (contains CPE_CONTAINER entries or null entries). - * - * @see ClasspathContainerInitializer - * @see IClasspathContainer - * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @since 2.0 - */ -//public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException { -// -// IClasspathContainer container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// -// if (container == null){ -// final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); -// if (initializer != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ -// new Exception("FAKE exception for dumping current CPContainer (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ -// } -// JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles -// boolean ok = false; -// try { -// // wrap initializer call with Safe runnable in case initializer would be causing some grief -// Platform.run(new ISafeRunnable() { -// public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$ -// } -// public void run() throws Exception { -// initializer.initialize(containerPath, project); -// } -// }); -// -// // retrieve value (if initialization was successful) -// container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// ok = true; -// } finally { -// if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache -// } -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$ -// if (container != null){ -// System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$ -// IClasspathEntry[] entries = container.getClasspathEntries(); -// if (entries != null){ -// for (int i = 0; i < entries.length; i++){ -// if (i > 0) System.out.println(", ");//$NON-NLS-1$ -// System.out.println(entries[i]); -// } -// } -// System.out.println("}");//$NON-NLS-1$ -// } else { -// System.out.println("{unbound}");//$NON-NLS-1$ -// } -// } -// } else { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// } -// } -// return container; -//} - -/** - * Helper method finding the classpath container initializer registered for a given classpath container ID - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A containerID is the first segment of any container path, used to identify the registered container initializer. - *

- * @param String - a containerID identifying a registered initializer - * @return ClasspathContainerInitializer - the registered classpath container initializer or null if - * none was found. - * @since 2.1 - */ -//public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){ -// -// Plugin jdtCorePlugin = JavaCore.getPlugin(); -// if (jdtCorePlugin == null) return null; -// -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ -// String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ -// if (initializerID != null && initializerID.equals(containerID)){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// try { -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathContainerInitializer){ -// return (ClasspathContainerInitializer)execExt; -// } -// } catch(CoreException e) { -// } -// } -// } -// } -// } -// return null; -//} - -/** - * Returns the path held in the given classpath variable. - * Returns null if unable to bind. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Note that classpath variables can be contributed registered initializers for, - * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * If an initializer is registered for a variable, its persisted value will be ignored: - * its initializer will thus get the opportunity to rebind the variable differently on - * each session. - * - * @param variableName the name of the classpath variable - * @return the path, or null if none - * @see #setClasspathVariable - */ -public static IPath getClasspathVariable(final String variableName) { - - IPath variablePath = JavaModelManager.variableGet(variableName); - if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle - - if (variablePath != null) { - return variablePath; - } - - // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused -// final ClasspathVariableInitializer initializer = PHPCore.getClasspathVariableInitializer(variableName); -// if (initializer != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$ -// new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$ -// } -// JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles -// boolean ok = false; -// try { -// // wrap initializer call with Safe runnable in case initializer would be causing some grief -// Platform.run(new ISafeRunnable() { -// public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// public void run() throws Exception { -// initializer.initialize(variableName); -// } -// }); -// variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect -// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call) -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$ -// } -// ok = true; -// } finally { -// if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache -// } -// } else { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$ -// } -// } - return variablePath; -} - -/** - * Helper method finding the classpath variable initializer registered for a given classpath variable name - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - *

- * @param the given variable - * @return ClasspathVariableInitializer - the registered classpath variable initializer or null if - * none was found. - * @since 2.1 - */ -public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){ - - Plugin jdtCorePlugin = PHPCore.getPlugin(); - if (jdtCorePlugin == null) return null; - -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ -// try { -// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ -// if (variable.equals(varAttribute)) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathVariableInitializer){ -// return (ClasspathVariableInitializer)execExt; -// } -// } -// } catch(CoreException e){ -// } -// } -// } -// } - return null; -} - -/** - * Returns the names of all known classpath variables. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @return the list of classpath variable names - * @see #setClasspathVariable - */ -//public static String[] getClasspathVariableNames() { -// return JavaModelManager.variableNames(); -//} - -/** - * Returns a table of all known configurable options with their default values. - * These options allow to configure the behaviour of the underlying components. - * The client may safely use the result as a template that they can modify and - * then pass to setOptions. - * - * Helper constants have been defined on JavaCore for each of the option ID and - * their possible constant values. - * - * Note: more options might be added in further releases. - *

- * RECOGNIZED OPTIONS:
- * COMPILER / Generating Local Variable Debug Attribute
- *    When generated, this attribute will enable local variable names 
- *    to be displayed in debugger, only in place where variables are 
- *    definitely assigned (.class file is then bigger)
- *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
- *     - possible values:   { "generate", "do not generate" }
- *     - default:           "generate"
- *
- * COMPILER / Generating Line Number Debug Attribute 
- *    When generated, this attribute will enable source code highlighting in debugger 
- *    (.class file is then bigger).
- *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
- *     - possible values:   { "generate", "do not generate" }
- *     - default:           "generate"
- *    
- * COMPILER / Generating Source Debug Attribute 
- *    When generated, this attribute will enable the debugger to present the 
- *    corresponding source code.
- *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
- *     - possible values:   { "generate", "do not generate" }
- *     - default:           "generate"
- *    
- * COMPILER / Preserving Unused Local Variables
- *    Unless requested to preserve unused local variables (that is, never read), the 
- *    compiler will optimize them out, potentially altering debugging
- *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
- *     - possible values:   { "preserve", "optimize out" }
- *     - default:           "preserve"
- * 
- * COMPILER / Defining Target Java Platform
- *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
- *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
- *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
- *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
- *     - default:           "1.1"
- *
- * COMPILER / Reporting Unreachable Code
- *    Unreachable code can optionally be reported as an error, warning or simply 
- *    ignored. The bytecode generation will always optimized it out.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "error"
- *
- * COMPILER / Reporting Invalid Import
- *    An import statement that cannot be resolved might optionally be reported 
- *    as an error, as a warning or ignored.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "error"
- *
- * COMPILER / Reporting Attempt to Override Package-Default Method
- *    A package default method is not visible in a different package, and thus 
- *    cannot be overridden. When enabling this option, the compiler will signal 
- *    such scenarii either as an error or a warning.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Method With Constructor Name
- *    Naming a method with a constructor name is generally considered poor 
- *    style programming. When enabling this option, the compiler will signal such 
- *    scenarii either as an error or a warning.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Deprecation
- *    When enabled, the compiler will signal use of deprecated API either as an 
- *    error or a warning.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Deprecation Inside Deprecated Code
- *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
- *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- *
- * COMPILER / Reporting Hidden Catch Block
- *    Locally to a try statement, some catch blocks may hide others . For example,
- *      try {  throw new java.io.CharConversionException();
- *      } catch (java.io.CharConversionException e) {
- *      } catch (java.io.IOException e) {}. 
- *    When enabling this option, the compiler will issue an error or a warning for hidden 
- *    catch blocks corresponding to checked exceptions
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Unused Local
- *    When enabled, the compiler will issue an error or a warning for unused local 
- *    variables (that is, variables never read from)
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Unused Parameter
- *    When enabled, the compiler will issue an error or a warning for unused method 
- *    parameters (that is, parameters never read from)
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
- *    When enabled, the compiler will signal unused parameters in abstract method implementations.
- *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- *
- * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
- *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
- *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- *
- * COMPILER / Reporting Unused Import
- *    When enabled, the compiler will issue an error or a warning for unused import 
- *    reference 
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Unused Private Members
- *    When enabled, the compiler will issue an error or a warning whenever a private 
- *    method or field is declared but never used within the same unit.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Synthetic Access Emulation
- *    When enabled, the compiler will issue an error or a warning whenever it emulates 
- *    access to a non-accessible member of an enclosing type. Such access can have
- *    performance implications.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Non-Externalized String Literal
- *    When enabled, the compiler will issue an error or a warning for non externalized 
- *    String literal (that is, not tagged with //$NON-NLS-$). 
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- * 
- * COMPILER / Reporting Usage of 'assert' Identifier
- *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
- *    used as an identifier (reserved keyword in 1.4)
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- * 
- * COMPILER / Reporting Non-Static Reference to a Static Member
- *    When enabled, the compiler will issue an error or a warning whenever a static field
- *    or method is accessed with an expression receiver. A reference to a static member should
- *    be qualified with a type name.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- * 
- * COMPILER / Reporting Assignment with no Effect
- *    When enabled, the compiler will issue an error or a warning whenever an assignment
- *    has no effect (e.g 'x = x').
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- * 
- * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
- *    When enabled, the compiler will issue an error or a warning whenever an interface
- *    defines a method incompatible with a non-inherited Object method. Until this conflict
- *    is resolved, such an interface cannot be implemented, For example, 
- *      interface I { 
- *         int clone();
- *      } 
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- * 
- * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
- *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
- *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Setting Source Compatibility Mode
- *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
- *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
- *   level should be set to "1.4" and the compliance mode should be "1.4".
- *     - option id:         "org.eclipse.jdt.core.compiler.source"
- *     - possible values:   { "1.3", "1.4" }
- *     - default:           "1.3"
- * 
- * COMPILER / Setting Compliance Level
- *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
- *    should not go beyond "1.3" level.
- *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
- *     - possible values:   { "1.3", "1.4" }
- *     - default:           "1.3"
- * 
- * COMPILER / Maximum number of problems reported per compilation unit
- *    Specify the maximum number of problems reported on each compilation unit.
- *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
- *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
- *     - default:           "100"
- * 
- * COMPILER / Define the Automatic Task Tags
- *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
- *    one of the corresponding tag inside any comment in Java source code.
- *    Generated task messages will include the tag, and range until the next line separator or comment ending.
- *    Note that tasks messages are trimmed.
- *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card or leading/trailing spaces 
- *     - default:           ""
- * 
- * COMPILER / Define the Automatic Task Priorities
- *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
- *    of the task markers issued by the compiler.
- *    If the default is specified, the priority of each task marker is "NORMAL".
- *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
- *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
- *     - default:           ""
- *
- * BUILDER / Specifying Filters for Resource Copying Control
- *    Allow to specify some filters to control the resource copy process.
- *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
- *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
- *       or the name of a folder which ends with '/'
- *     - default:           ""
- * 
- * BUILDER / Abort if Invalid Classpath
- *    Allow to toggle the builder to abort if the classpath is invalid
- *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
- *     - possible values:   { "abort", "ignore" }
- *     - default:           "abort"
- * 
- * BUILDER / Cleaning Output Folder(s)
- *    Indicate whether the JavaBuilder is allowed to clean the output folders
- *    when performing full build operations.
- *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
- *     - possible values:   { "clean", "ignore" }
- *     - default:           "clean"
- * 
- * BUILDER / Reporting Duplicate Resources
- *    Indicate the severity of the problem reported when more than one occurrence
- *    of a resource is to be copied into the output location.
- *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
- *     - possible values:   { "error", "warning" }
- *     - default:           "warning"
- * 
- * JAVACORE / Computing Project Build Order
- *    Indicate whether JavaCore should enforce the project build order to be based on
- *    the classpath prerequisite chain. When requesting to compute, this takes over
- *    the platform default order (based on project references).
- *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
- *     - possible values:   { "compute", "ignore" }
- *     - default:           "ignore"	 
- * 
- * JAVACORE / Specify Default Source Encoding Format
- *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
- *    to 'ResourcesPlugin.getEncoding()'.
- *     - option id:         "org.eclipse.jdt.core.encoding"
- *     - possible values:   { any of the supported encoding name}.
- *     - default:           
- * 
- * JAVACORE / Reporting Incomplete Classpath
- *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
- *    is not legite or is not visible (for example, a referenced project is closed).
- *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
- *     - possible values:   { "error", "warning"}
- *     - default:           "error"
- * 
- * JAVACORE / Reporting Classpath Cycle
- *    Indicate the severity of the problem reported when a project is involved in a cycle.
- *     - option id:         "org.eclipse.jdt.core.circularClasspath"
- *     - possible values:   { "error", "warning" }
- *     - default:           "error"
- * 
- * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
- *    When disabled, no entry on a project classpath can be associated with
- *    an exclusion pattern.
- *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "enabled"
- * 
- * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
- *    When disabled, no entry on a project classpath can be associated with
- *    a specific output location, preventing thus usage of multiple output locations.
- *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "enabled"
- * 
- *	FORMATTER / Inserting New Line Before Opening Brace
- *    When Insert, a new line is inserted before an opening brace, otherwise nothing
- *    is inserted
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "do not insert"
- * 
- *	FORMATTER / Inserting New Line Inside Control Statement
- *    When Insert, a new line is inserted between } and following else, catch, finally
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "do not insert"
- * 
- *	FORMATTER / Clearing Blank Lines
- *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
- *    and all others removed.
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
- *     - possible values:   { "clear all", "preserve one" }
- *     - default:           "preserve one"
- * 
- *	FORMATTER / Inserting New Line Between Else/If 
- *    When Insert, a blank line is inserted between an else and an if when they are 
- *    contiguous. When choosing to not insert, else-if will be kept on the same
- *    line when possible.
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "do not insert"
- * 
- *	FORMATTER / Inserting New Line In Empty Block
- *    When insert, a line break is inserted between contiguous { and }, if } is not followed
- *    by a keyword.
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "insert"
- * 
- *	FORMATTER / Splitting Lines Exceeding Length
- *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
- *    disable line splitting
- *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
- *     - possible values:	"", where n is zero or a positive integer
- *     - default:           "80"
- * 
- *	FORMATTER / Compacting Assignment
- *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
- *    is inserted before the assignment operator
- *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
- *     - possible values:   { "compact", "normal" }
- *     - default:           "normal"
- * 
- *	FORMATTER / Defining Indentation Character
- *    Either choose to indent with tab characters or spaces
- *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
- *     - possible values:   { "tab", "space" }
- *     - default:           "tab"
- * 
- *	FORMATTER / Defining Space Indentation Length
- *    When using spaces, set the amount of space characters to use for each 
- *    indentation mark.
- *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
- *     - possible values:	"", where n is a positive integer
- *     - default:           "4"
- * 
- *	FORMATTER / Inserting space in cast expression
- *    When Insert, a space is added between the type and the expression in a cast expression.
- *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "insert"
- * 
- *	CODEASSIST / Activate Visibility Sensitive Completion
- *    When active, completion doesn't show that you can not see
- *    (for example, you can not see private methods of a super class).
- *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- * 
- *	CODEASSIST / Automatic Qualification of Implicit Members
- *    When active, completion automatically qualifies completion on implicit
- *    field references and message expressions.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- * 
- *  CODEASSIST / Define the Prefixes for Field Name
- *    When the prefixes is non empty, completion for field name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Prefixes for Static Field Name
- *    When the prefixes is non empty, completion for static field name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Prefixes for Local Variable Name
- *    When the prefixes is non empty, completion for local variable name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Prefixes for Argument Name
- *    When the prefixes is non empty, completion for argument name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Field Name
- *    When the suffixes is non empty, completion for field name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Static Field Name
- *    When the suffixes is non empty, completion for static field name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Local Variable Name
- *    When the suffixes is non empty, completion for local variable name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Argument Name
- *    When the suffixes is non empty, completion for argument name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- * - * @return a mutable table containing the default settings of all known options - * (key type: String; value type: String) - * @see #setOptions - */ -public static Hashtable getDefaultOptions(){ - - Hashtable defaultOptions = new Hashtable(10); - - // see #initializeDefaultPluginPreferences() for changing default settings - Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // get preferences set to their default - String[] defaultPropertyNames = preferences.defaultPropertyNames(); - for (int i = 0; i < defaultPropertyNames.length; i++){ - String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get preferences not set to their default - String[] propertyNames = preferences.propertyNames(); - for (int i = 0; i < propertyNames.length; i++){ - String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get encoding through resource plugin - defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - - return defaultOptions; -} - -/** - * Returns the single instance of the Java core plug-in runtime class. - * Equivalent to (JavaCore) getPlugin(). - * - * @return the single instance of the Java core plug-in runtime class - */ -public static PHPeclipsePlugin getJavaCore() { - return (PHPeclipsePlugin) getPlugin(); -} - -/** - * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) - * Note that it may answer null if this option does not exist. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param optionName the name of an option - * @return the String value of a given option - * @see JavaCore#getDefaultOptions - * @since 2.0 - */ -public static String getOption(String optionName) { - - if (CORE_ENCODING.equals(optionName)){ - return ResourcesPlugin.getEncoding(); - } - if (JavaModelManager.OptionNames.contains(optionName)){ - Preferences preferences = getPlugin().getPluginPreferences(); - return preferences.getString(optionName).trim(); - } - return null; -} - -/** - * Returns the table of the current options. Initially, all options have their default values, - * and this method returns a table that includes all known options. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @return table of current settings of all options - * (key type: String; value type: String) - * @see JavaCore#getDefaultOptions - */ -public static Hashtable getOptions() { - - Hashtable options = new Hashtable(10); - - // see #initializeDefaultPluginPreferences() for changing default settings - Plugin plugin = getPlugin(); - if (plugin != null) { - Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // get preferences set to their default - String[] defaultPropertyNames = preferences.defaultPropertyNames(); - for (int i = 0; i < defaultPropertyNames.length; i++){ - String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get preferences not set to their default - String[] propertyNames = preferences.propertyNames(); - for (int i = 0; i < propertyNames.length; i++){ - String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getString(propertyName).trim()); - } - } - // get encoding through resource plugin - options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - } - return options; -} - -/** - * This is a helper method, which returns the resolved classpath entry denoted - * by a given entry (if it is a variable entry). It is obtained by resolving the variable - * reference in the first segment. Returns null if unable to resolve using - * the following algorithm: - *
    - *
  • if variable segment cannot be resolved, returns null
  • - *
  • finds a project, JAR or binary folder in the workspace at the resolved path location
  • - *
  • if none finds an external JAR file or folder outside the workspace at the resolved path location
  • - *
  • if none returns null
  • - *
- *

- * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry. - *

- * NOTE: This helper method does not handle classpath containers, for which should rather be used - * JavaCore#getClasspathContainer(IPath, IJavaProject). - *

- * - * @param entry the given variable entry - * @return the resolved library or project classpath entry, or null - * if the given variable entry could not be resolved to a valid classpath entry - */ -public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) { - - if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) - return entry; - - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - IPath resolvedPath = PHPCore.getResolvedVariablePath(entry.getPath()); - if (resolvedPath == null) - return null; - - Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false); - if (target == null) - return null; - - // inside the workspace - if (target instanceof IResource) { - IResource resolvedResource = (IResource) target; - if (resolvedResource != null) { - switch (resolvedResource.getType()) { - - case IResource.PROJECT : - // internal project - return PHPCore.newProjectEntry(resolvedPath, entry.isExported()); - - case IResource.FILE : -// if (Util.isArchiveFileName(resolvedResource.getName())) { -// // internal binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } - break; - - case IResource.FOLDER : - // internal binary folder -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); - break; - } - } - } - // outside the workspace - if (target instanceof File) { - File externalFile = (File) target; - if (externalFile.isFile()) { - String fileName = externalFile.getName().toLowerCase(); -// if (fileName.endsWith(".jar" //$NON-NLS-1$ -// ) || fileName.endsWith(".zip" //$NON-NLS-1$ -// )) { // external binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } - } else { // external binary folder - if (resolvedPath.isAbsolute()){ -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); - } - } - } - return null; -} - - -/** - * Resolve a variable path (helper method). - * - * @param variablePath the given variable path - * @return the resolved variable path or null if none - */ -public static IPath getResolvedVariablePath(IPath variablePath) { - - if (variablePath == null) - return null; - int count = variablePath.segmentCount(); - if (count == 0) - return null; - - // lookup variable - String variableName = variablePath.segment(0); - IPath resolvedPath = PHPCore.getClasspathVariable(variableName); - if (resolvedPath == null) - return null; - - // append path suffix - if (count > 1) { - resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1)); - } - return resolvedPath; -} - -/** - * Answers the shared working copies currently registered for this buffer factory. - * Working copies can be shared by several clients using the same buffer factory,see - * IWorkingCopy.getSharedWorkingCopy. - * - * @param factory the given buffer factory - * @return the list of shared working copies for a given buffer factory - * @see IWorkingCopy - * @since 2.0 - */ -public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){ - - // if factory is null, default factory must be used - if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory(); - Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies; - - Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory); - if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy; - Collection copies = perFactoryWorkingCopies.values(); - IWorkingCopy[] result = new IWorkingCopy[copies.size()]; - copies.toArray(result); - return result; -} - -/** - * Initializes the default preferences settings for this plug-in. - */ -protected static void initializeDefaultPluginPreferences() { - - Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // Compiler settings - preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); - optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR); - - preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); - optionNames.add(COMPILER_LINE_NUMBER_ATTR); - - preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); - optionNames.add(COMPILER_SOURCE_FILE_ATTR); - - preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); - optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL); - - preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); - optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); - - preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); - optionNames.add(COMPILER_PB_UNREACHABLE_CODE); - - preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); - optionNames.add(COMPILER_PB_INVALID_IMPORT); - - preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); - optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); - - preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); - optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); - - preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING); - optionNames.add(COMPILER_PB_DEPRECATION); - - preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED); - optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); - - preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); - optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK); - - preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_LOCAL); - - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER); - - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); - - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); - - preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); - optionNames.add(COMPILER_PB_UNUSED_IMPORT); - - preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER); - - preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); - optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); - - preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); - optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL); - - preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); - optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER); - - preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); - optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER); - - preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); - optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT); - - preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); - optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); - - preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); - optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); - - preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_TAGS); - - preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_PRIORITIES); - - preferences.setDefault(COMPILER_SOURCE, VERSION_1_3); - optionNames.add(COMPILER_SOURCE); - - preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); - optionNames.add(COMPILER_COMPLIANCE); - - preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$ - optionNames.add(COMPILER_PB_MAX_PER_UNIT); - - // Builder settings - preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ - optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER); - - preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); - optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH); - - preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); - optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE); - - preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); - optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER); - - // JavaCore settings - preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); - optionNames.add(CORE_JAVA_BUILD_ORDER); - - preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); - optionNames.add(CORE_CIRCULAR_CLASSPATH); - - preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); - optionNames.add(CORE_INCOMPLETE_CLASSPATH); - - preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS); - - preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS); - - // encoding setting comes from resource plug-in - optionNames.add(CORE_ENCODING); - - // Formatter settings - preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE); - - preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_CONTROL); - - preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); - optionNames.add(FORMATTER_CLEAR_BLANK_LINES); - - preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_ELSE_IF); - - preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); - optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK); - - preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$ - optionNames.add(FORMATTER_LINE_SPLIT); - - preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); - optionNames.add(FORMATTER_COMPACT_ASSIGNMENT); - - preferences.setDefault(FORMATTER_TAB_CHAR, TAB); - optionNames.add(FORMATTER_TAB_CHAR); - - preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ - optionNames.add(FORMATTER_TAB_SIZE); - - preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ - optionNames.add(FORMATTER_SPACE_CASTEXPRESSION); - - // CodeAssist settings - preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_VISIBILITY_CHECK); - - preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION); - - preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_PREFIXES); - - preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES); - - preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_PREFIXES); - - preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_PREFIXES); - - preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_SUFFIXES); - - preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES); - - preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_SUFFIXES); - - preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES); -} - -/** - * Returns whether the given marker references the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param element the element - * @param marker the marker - * @return true if the marker references the element, false otherwise - * @exception CoreException if the IMarker.getAttribute on the marker fails - */ -public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException { - - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } - } - if (element == null) return false; - if (marker == null) return false; - - String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID); - if (markerHandleId == null) return false; - - IJavaElement markerElement = PHPCore.create(markerHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } -// } -// break; -// } - return false; -} - -/** - * Returns whether the given marker delta references the given Java element. - * Used for markers deltas, which denote a Java element rather than a resource. - * - * @param element the element - * @param markerDelta the marker delta - * @return true if the marker delta references the element - * @exception CoreException if the IMarkerDelta.getAttribute on the marker delta fails - */ -public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException { - - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } - } - if (element == null) return false; - if (markerDelta == null) return false; - - String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID); - if (markerDeltarHandleId == null) return false; - - IJavaElement markerElement = PHPCore.create(markerDeltarHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } -// } -// break; -// } - return false; -} - -/** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newContainerEntry(-,false). - *

- * @param containerPath the path identifying the container, it must be formed of two - * segments - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -public static IClasspathEntry newContainerEntry(IPath containerPath) { - - return newContainerEntry(containerPath, false); -} - -/** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * @param containerPath the path identifying the container, it must be formed of at least - * one segment (ID+hints) - * @param isExported a boolean indicating whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) { - - if (containerPath == null || containerPath.segmentCount() < 1) { - Assert.isTrue( - false, - "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ - } - return new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IClasspathEntry.CPE_CONTAINER, - containerPath, - ClasspathEntry.NO_EXCLUSION_PATTERNS, - null, // source attachment - null, // source attachment root - null, // specific output folder - isExported); -} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the - * JAR or folder identified by the given absolute path. This specifies that all package fragments - * within the root will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newLibraryEntry(-,-,-,false). - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @return a new library classpath entry - * - * @see #newLibraryEntry(IPath, IPath, IPath, boolean) - */ -//public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath) { -// -// return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false); -//} - -/** - * Creates and returns a new classpath entry of kind CPE_LIBRARY for the JAR or folder - * identified by the given absolute path. This specifies that all package fragments within the root - * will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new library classpath entry - * @since 2.0 - */ -//public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath, -// boolean isExported) { -// -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_BINARY, -// IClasspathEntry.CPE_LIBRARY, -// JavaProject.canonicalizedPath(path), -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// sourceAttachmentPath, -// sourceAttachmentRootPath, -// null, // specific output folder -// isExported); -//} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newProjectEntry(_,false). - *

- * - * @param path the absolute path of the binary archive - * @return a new project classpath entry - * - * @see JavaCore#newProjectEntry(IPath, boolean) - */ -public static IClasspathEntry newProjectEntry(IPath path) { - return newProjectEntry(path, false); -} - -/** - * Creates and returns a new classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * - * @param path the absolute path of the prerequisite project - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new project classpath entry - * @since 2.0 - */ -public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { - - if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ - - return new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IClasspathEntry.CPE_PROJECT, - path, - ClasspathEntry.NO_EXCLUSION_PATTERNS, - null, // source attachment - null, // source attachment root - null, // specific output folder - isExported); -} - -/** - * Returns a new empty region. - * - * @return a new empty region - */ -public static IRegion newRegion() { - return new Region(); -} - -/** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path. This specifies that all package fragments - * within the root will have children of type ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path. To selectively exclude - * some of these source files, use the factory method - * JavaCore.newSourceEntry(IPath,IPath[]) instead. - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @return a new source classpath entry with not exclusion patterns - * - * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[]) - */ -public static IClasspathEntry newSourceEntry(IPath path) { - - return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/); -} - -/** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns. This specifies that all package - * fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * - * @since 2.1 - */ -public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { - - return newSourceEntry(path, exclusionPatterns, null /*output location*/); -} - -/** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns, and associated with a specific output location - * (that is, ".class" files are not going to the project default output location). - * All package fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Additionally, a source entry can be associated with a specific output location. - * By doing so, the Java builder will ensure that the generated ".class" files will - * be issued inside this output location, as opposed to be generated into the - * project default output location (when output location is null). - * Note that multiple source entries may target the same output location. - * The output location is referred to using an absolute path relative to the - * workspace root, e.g. "/Project/bin", it must be located inside - * the same project as the source folder. - *

- *

- * Also note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @param outputLocation the specific output location for this source entry (null if using project default ouput location) - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * @see IClasspathEntry#getOutputLocation() - * - * @since 2.1 - */ -public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) { - - if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ - if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ - - return new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IClasspathEntry.CPE_SOURCE, - path, - exclusionPatterns, - null, // source attachment - null, // source attachment root - specificOutputLocation, // custom output location - false); -} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newVariableEntry(-,-,-,false). - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @return a new library classpath entry - * - * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean) - */ -//public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath sourceAttachmentRootPath) { -// -// return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false); -//} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new variable classpath entry - * @since 2.0 - */ -//public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath variableSourceAttachmentRootPath, -// boolean isExported) { -// -// if (variablePath == null || variablePath.segmentCount() < 1) { -// Assert.isTrue( -// false, -// "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ -// } -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_VARIABLE, -// variablePath, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// variableSourceAttachmentPath, // source attachment -// variableSourceAttachmentRootPath, // source attachment root -// null, // specific output folder -// isExported); -//} - -/** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @see #setClasspathVariable - * - * @deprecated - use version with extra IProgressMonitor - */ -//public static void removeClasspathVariable(String variableName) { -// removeClasspathVariable(variableName, null); -//} - -/** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param monitor the progress monitor to report progress - * @see #setClasspathVariable - */ -//public static void removeClasspathVariable( -// String variableName, -// IProgressMonitor monitor) { -// -// try { -// updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor); -// } catch (JavaModelException e) { -// } -//} - -/** - * Removes the given element changed listener. - * Has no affect if an identical listener is not registered. - * - * @param listener the listener - */ -public static void removeElementChangedListener(IElementChangedListener listener) { - JavaModelManager.getJavaModelManager().removeElementChangedListener(listener); -} - -/** - * Bind a container reference path to some actual containers (IClasspathContainer). - * This API must be invoked whenever changes in container need to be reflected onto the JavaModel. - * Containers can have distinct values in different projects, therefore this API considers a - * set of projects with their respective containers. - *

- * containerPath is the path under which these values can be referenced through - * container classpath entries (IClasspathEntry#CPE_CONTAINER). A container path - * is formed by a first ID segment followed with extra segments, which can be used as additional hints - * for the resolution. The container ID is used to identify a ClasspathContainerInitializer - * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that each individual container value passed in argument - * (respectiveContainers) must answer the exact same path when requested - * IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be - * delegated to a ClasspathContainerInitializer, which can be activated through the extension - * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * In reaction to changing container values, the JavaModel will be updated to reflect the new - * state of the updated container. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * Note: setting a container to null will cause it to be lazily resolved again whenever - * its value is required. In particular, this will cause a registered initializer to be invoked - * again. - *

- * @param containerPath - the name of the container reference, which is being updated - * @param affectedProjects - the set of projects for which this container is being bound - * @param respectiveContainers - the set of respective containers for the affected projects - * @param monitor a monitor to report progress - * - * @see ClasspathContainerInitializer - * @see #getClasspathContainer(IPath, IJavaProject) - * @see IClasspathContainer - * @since 2.0 - */ -//public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { -// -// if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ -// -// if (monitor != null && monitor.isCanceled()) return; -// -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer SET - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$ -// + (Util.toString(affectedProjects, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } -// })) -// + "} with values: " //$NON-NLS-1$ -// + (Util.toString(respectiveContainers, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); } -// })) -// ); -// } -// -// final int projectLength = affectedProjects.length; -// final IJavaProject[] modifiedProjects; -// System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength); -// final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][]; -// -// // filter out unmodified project containers -// int remaining = 0; -// for (int i = 0; i < projectLength; i++){ -// -// if (monitor != null && monitor.isCanceled()) return; -// -// IJavaProject affectedProject = affectedProjects[i]; -// IClasspathContainer newContainer = respectiveContainers[i]; -// if (newContainer == null) newContainer = JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent infinite loop -// boolean found = false; -// if (JavaProject.hasJavaNature(affectedProject.getProject())){ -// IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath(); -// for (int j = 0, cpLength = rawClasspath.length; j - * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param path the path - * @see #getClasspathVariable - * - * @deprecated - use API with IProgressMonitor - */ -//public static void setClasspathVariable(String variableName, IPath path) -// throws JavaModelException { -// -// setClasspathVariable(variableName, path, null); -//} - -/** - * Sets the value of the given classpath variable. - * The path must not be null. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableName the name of the classpath variable - * @param path the path - * @param monitor a monitor to report progress - * @see #getClasspathVariable - */ -//public static void setClasspathVariable( -// String variableName, -// IPath path, -// IProgressMonitor monitor) -// throws JavaModelException { -// -// if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ -// setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); -//} - -/** - * Sets the values of all the given classpath variables at once. - * Null paths can be used to request corresponding variable removal. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableNames an array of names for the updated classpath variables - * @param paths an array of path updates for the modified classpath variables (null - * meaning that the corresponding value will be removed - * @param monitor a monitor to report progress - * @see #getClasspathVariable - * @since 2.0 - */ -//public static void setClasspathVariables( -// String[] variableNames, -// IPath[] paths, -// IProgressMonitor monitor) -// throws JavaModelException { -// -// if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ -// //TODO: should check that null cannot be used as variable paths -// updateVariableValues(variableNames, paths, monitor); -//} - -/* (non-Javadoc) - * Method declared on IExecutableExtension. - * Record any necessary initialization data from the plugin. - */ -public void setInitializationData( - IConfigurationElement cfig, - String propertyName, - Object data) - throws CoreException { -} - -/** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param newOptions the new options (key type: String; value type: String), - * or null to reset all options to their default values - * @see JavaCore#getDefaultOptions - */ -public static void setOptions(Hashtable newOptions) { - - // see #initializeDefaultPluginPreferences() for changing default settings - Preferences preferences = getPlugin().getPluginPreferences(); - - if (newOptions == null){ - newOptions = PHPCore.getDefaultOptions(); - } - Enumeration keys = newOptions.keys(); - while (keys.hasMoreElements()){ - String key = (String)keys.nextElement(); - if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option - if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs - String value = (String)newOptions.get(key); - preferences.setValue(key, value); - } - - // persist options - getPlugin().savePluginPreferences(); -} - -/** - * Shutdown the JavaCore plug-in. - *

- * De-registers the JavaModelManager as a resource changed listener and save participant. - *

- * @see org.eclipse.core.runtime.Plugin#shutdown() - */ -public void shutdown() { - - //savePluginPreferences(); - getPlugin().savePluginPreferences(); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor); - workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault()); - - ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); -} - -/** - * Initiate the background indexing process. - * This should be deferred after the plugin activation. - */ -//private void startIndexing() { -// -// JavaModelManager.getJavaModelManager().getIndexManager().reset(); -//} - -/** - * Startup of the JavaCore plug-in. - *

- * Registers the JavaModelManager as a resource changed listener and save participant. - * Starts the background indexing, and restore saved classpath variable values. - *

- * @see org.eclipse.core.runtime.Plugin#startup() - */ -public void startup() { - - JavaModelManager manager = JavaModelManager.getJavaModelManager(); - try { - manager.configurePluginDebugOptions(); - - // request state folder creation (workaround 19885) - PHPCore.getPlugin().getStateLocation(); - - // retrieve variable values - PHPCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); -// TODO khartlage temp-del -// manager.loadVariablesAndContainers(); - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener( - manager.deltaProcessor, - IResourceChangeEvent.PRE_AUTO_BUILD - | IResourceChangeEvent.POST_AUTO_BUILD - | IResourceChangeEvent.POST_CHANGE - | IResourceChangeEvent.PRE_DELETE - | IResourceChangeEvent.PRE_CLOSE); - -// startIndexing(); - workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager); - - } catch (CoreException e) { - } catch (RuntimeException e) { - manager.shutdown(); - throw e; - } -} - - -/** - * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once. - */ -//private static void updateVariableValues( -// String[] variableNames, -// IPath[] variablePaths, -// IProgressMonitor monitor) throws JavaModelException { -// -// if (monitor != null && monitor.isCanceled()) return; -// -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - setting variables: {" + Util.toString(variableNames) //$NON-NLS-1$ -// + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$ -// } -// -// int varLength = variableNames.length; -// -// // gather classpath information for updating -// final HashMap affectedProjects = new HashMap(5); -// JavaModelManager manager = JavaModelManager.getJavaModelManager(); -// IJavaModel model = manager.getJavaModel(); -// -// // filter out unmodified variables -// int discardCount = 0; -// for (int i = 0; i < varLength; i++){ -// String variableName = variableNames[i]; -// IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value -// if (oldPath == JavaModelManager.VariableInitializationInProgress){ -// IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName); -// if (previousPath != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value -// } -// oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP -// } -// if (oldPath != null && oldPath.equals(variablePaths[i])){ -// variableNames[i] = null; -// discardCount++; -// } -// } -// if (discardCount > 0){ -// if (discardCount == varLength) return; -// int changedLength = varLength - discardCount; -// String[] changedVariableNames = new String[changedLength]; -// IPath[] changedVariablePaths = new IPath[changedLength]; -// for (int i = 0, index = 0; i < varLength; i++){ -// if (variableNames[i] != null){ -// changedVariableNames[index] = variableNames[i]; -// changedVariablePaths[index] = variablePaths[i]; -// index++; -// } -// } -// variableNames = changedVariableNames; -// variablePaths = changedVariablePaths; -// varLength = changedLength; -// } -// -// if (monitor != null && monitor.isCanceled()) return; -// -// if (model != null) { -// IJavaProject[] projects = model.getJavaProjects(); -// nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){ -// IJavaProject project = projects[i]; -// -// // check to see if any of the modified variables is present on the classpath -// IClasspathEntry[] classpath = project.getRawClasspath(); -// for (int j = 0, cpLength = classpath.length; j < cpLength; j++){ -// -// IClasspathEntry entry = classpath[j]; -// for (int k = 0; k < varLength; k++){ -// -// String variableName = variableNames[k]; -// if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ -// -// if (variableName.equals(entry.getPath().segment(0))){ -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// IPath sourcePath, sourceRootPath; -// if (((sourcePath = entry.getSourceAttachmentPath()) != null && variableName.equals(sourcePath.segment(0))) -// || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null && variableName.equals(sourceRootPath.segment(0)))) { -// -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// } -// } -// } -// } -// } -// // update variables -// for (int i = 0; i < varLength; i++){ -// JavaModelManager.variablePut(variableNames[i], variablePaths[i]); -// } -// final String[] dbgVariableNames = variableNames; -// -// // update affected project classpaths -// if (!affectedProjects.isEmpty()) { -// try { -// JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run( -// new IWorkspaceRunnable() { -// public void run(IProgressMonitor monitor) throws CoreException { -// // propagate classpath change -// Iterator projectsToUpdate = affectedProjects.keySet().iterator(); -// while (projectsToUpdate.hasNext()) { -// -// if (monitor != null && monitor.isCanceled()) return; -// -// JavaProject project = (JavaProject) projectsToUpdate.next(); -// -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// project -// .setRawClasspath( -// project.getRawClasspath(), -// SetClasspathOperation.ReuseOutputLocation, -// null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717) -// !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources -// (IClasspathEntry[]) affectedProjects.get(project), -// false, // updating - no validation -// false); // updating - no need to save -// } -// } -// }, -// monitor); -// } catch (CoreException e) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$ -// e.printStackTrace(); -// } -// if (e instanceof JavaModelException) { -// throw (JavaModelException)e; -// } else { -// throw new JavaModelException(e); -// } -// } -// } -//} -} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 735cda1..4511487 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -1,16 +1,15 @@ /********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation - Klaus Hartlage - www.eclipseproject.de -**********************************************************************/ + Copyright (c) 2000, 2002 IBM Corp. and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + + Contributors: + IBM Corporation - Initial implementation + Klaus Hartlage - www.eclipseproject.de + **********************************************************************/ package net.sourceforge.phpeclipse; - import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -19,10 +18,11 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; - +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.externaltools.internal.model.ColorManager; import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin; import net.sourceforge.phpdt.externaltools.internal.model.VariableContextManager; +import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.ui.preferences.MembersOrderPreferenceCache; import net.sourceforge.phpdt.internal.ui.preferences.TemplatePreferencePage; import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverDescriptor; @@ -43,11 +43,11 @@ import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider; import net.sourceforge.phpeclipse.resourcesview.PHPElement; import net.sourceforge.phpeclipse.resourcesview.PHPElementAdapterFactory; import net.sourceforge.phpeclipse.resourcesview.ResourceAdapterFactory; - import org.eclipse.core.boot.BootLoader; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -79,85 +79,66 @@ import org.eclipse.ui.ide.IDE; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; - /** * The main plugin class to be used in the desktop. */ -public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceConstants { +public class PHPeclipsePlugin extends AbstractUIPlugin + implements + IPreferenceConstants { /** * The id of the PHP plugin (value "net.sourceforge.phpeclipse"). */ public static final String PLUGIN_ID = "net.sourceforge.phpeclipse"; //$NON-NLS-1$ - - /** - * id of builder - matches plugin.xml (concatenate pluginid.builderid) + /** + * id of builder - matches plugin.xml (concatenate pluginid.builderid) */ public static final String BUILDER_PARSER_ID = PLUGIN_ID + ".parserbuilder"; //public static final String BUILDER_INDEX_ID = PLUGIN_ID + ".indexbuilder"; - - /** General debug flag*/ + /** General debug flag */ public static final boolean DEBUG = false; - /** * The maximum number of allowed proposals by category */ public final static int MAX_PROPOSALS = 200; - private static ExternalToolsPlugin externalTools; - /** - * The Java virtual machine that we are running on. - */ + * The Java virtual machine that we are running on. + */ private static int jvm; - /** MRJ 2.0 */ private static final int MRJ_2_0 = 0; - /** MRJ 2.1 or later */ private static final int MRJ_2_1 = 1; - /** Java on Mac OS X 10.0 (MRJ 3.0) */ private static final int MRJ_3_0 = 3; - /** MRJ 3.1 */ private static final int MRJ_3_1 = 4; - /** JVM constant for any other platform */ private static final int OTHER = -1; - - // public static final String PHP_RESOURCES_VIEW_ID = PLUGIN_ID + ".resourcesview.ViewPHPResources"; //$NON-NLS-1$ - public static final String PHP_CODING_ACTION_SET_ID = PLUGIN_ID + ".ui.CodingActionSet"; //$NON-NLS-1$ + // public static final String PHP_RESOURCES_VIEW_ID = PLUGIN_ID + + // ".resourcesview.ViewPHPResources"; //$NON-NLS-1$ + public static final String PHP_CODING_ACTION_SET_ID = PLUGIN_ID + + ".ui.CodingActionSet"; //$NON-NLS-1$ public final static String PHP_NATURE_ID = PLUGIN_ID + ".phpnature"; - public static final String PHPPARSER_ORIGINAL = "net.sourceforge.phpdt.internal.compiler.parser.Parser"; - public static final String PHPPARSER_NEW = "test.PHPParser"; - /** Change this if you want to switch PHP Parser. */ public static final String PHPPARSER = PHPPARSER_ORIGINAL; - //The shared instance. private static PHPeclipsePlugin plugin; - - /** Windows 9x */ + /** Windows 9x */ private static final int WINDOWS_9x = 6; - - /** Windows NT */ + /** Windows NT */ private static final int WINDOWS_NT = 5; - private ImageDescriptorRegistry fImageDescriptorRegistry; private HashMap fIndexManagerMap = new HashMap(); - private IWorkingCopyManager fWorkingCopyManager; private PHPDocumentProvider fCompilationUnitDocumentProvider; private JavaTextTools fJavaTextTools; private ProblemMarkerManager fProblemMarkerManager; - private MembersOrderPreferenceCache fMembersOrderPreferenceCache; - + private MembersOrderPreferenceCache fMembersOrderPreferenceCache; private IFile fLastEditorFile = null; - - private JavaEditorTextHoverDescriptor[] fJavaEditorTextHoverDescriptors; - + private JavaEditorTextHoverDescriptor[] fJavaEditorTextHoverDescriptors; /** * The constructor. */ @@ -167,69 +148,68 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon setJVM(); externalTools = new ExternalToolsPlugin(); // try { - // resourceBundle = ResourceBundle.getBundle("net.sourceforge.PHPeclipsePluginResources"); + // resourceBundle = + // ResourceBundle.getBundle("net.sourceforge.PHPeclipsePluginResources"); // } catch (MissingResourceException x) { // resourceBundle = null; // } } - /** - * Returns all Java editor text hovers contributed to the workbench. - * - * @return an array of JavaEditorTextHoverDescriptor - * @since 2.1 - */ - public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() { - if (fJavaEditorTextHoverDescriptors == null) - fJavaEditorTextHoverDescriptors= JavaEditorTextHoverDescriptor.getContributedHovers(); - return fJavaEditorTextHoverDescriptors; - } - - /** - * Resets the Java editor text hovers contributed to the workbench. - *

- * This will force a rebuild of the descriptors the next time - * a client asks for them. - *

- * - * @return an array of JavaEditorTextHoverDescriptor - * @since 2.1 - */ - public void resetJavaEditorTextHoverDescriptors() { - fJavaEditorTextHoverDescriptors= null; - } - /** - * Creates the PHP plugin standard groups in a context menu. - */ - public static void createStandardGroups(IMenuManager menu) { - if (!menu.isEmpty()) - return; - - menu.add(new Separator(IContextMenuConstants.GROUP_NEW)); - menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO)); - menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); - menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW)); - menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE)); - menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); - menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); - menu.add(new Separator(IContextMenuConstants.GROUP_BUILD)); - menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); - menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP)); - menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES)); - } + /** + * Returns all Java editor text hovers contributed to the workbench. + * + * @return an array of JavaEditorTextHoverDescriptor + * @since 2.1 + */ + public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() { + if (fJavaEditorTextHoverDescriptors == null) + fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor + .getContributedHovers(); + return fJavaEditorTextHoverDescriptors; + } + /** + * Resets the Java editor text hovers contributed to the workbench. + *

+ * This will force a rebuild of the descriptors the next time a client asks + * for them. + *

+ * + * @return an array of JavaEditorTextHoverDescriptor + * @since 2.1 + */ + public void resetJavaEditorTextHoverDescriptors() { + fJavaEditorTextHoverDescriptors = null; + } + /** + * Creates the PHP plugin standard groups in a context menu. + */ + public static void createStandardGroups(IMenuManager menu) { + if (!menu.isEmpty()) + return; + menu.add(new Separator(IContextMenuConstants.GROUP_NEW)); + menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO)); + menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); + menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW)); + menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE)); + menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); + menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); + menu.add(new Separator(IContextMenuConstants.GROUP_BUILD)); + menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); + menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP)); + menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES)); + } public static IWorkbenchPage getActivePage() { return getDefault().internalGetActivePage(); } - public static Shell getActiveWorkbenchShell() { return getActiveWorkbenchWindow().getShell(); } - /** - * Returns an array of all editors that have an unsaved content. If the identical content is - * presented in more than one editor, only one of those editor parts is part of the result. - * - * @return an array of all dirty editor parts. - */ + * Returns an array of all editors that have an unsaved content. If the + * identical content is presented in more than one editor, only one of those + * editor parts is part of the result. + * + * @return an array of all dirty editor parts. + */ public static IEditorPart[] getDirtyEditors() { Set inputs = new HashSet(); List result = new ArrayList(0); @@ -251,7 +231,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } return (IEditorPart[]) result.toArray(new IEditorPart[result.size()]); } - public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); } @@ -261,26 +240,22 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon public static PHPeclipsePlugin getDefault() { return plugin; } - public static ImageDescriptorRegistry getImageDescriptorRegistry() { return getDefault().internalGetImageDescriptorRegistry(); } - static IPath getInstallLocation() { return new Path(getDefault().getDescriptor().getInstallURL().getFile()); } public static int getJVM() { return jvm; } - public static String getPluginId() { return getDefault().getDescriptor().getUniqueIdentifier(); } - /** - * Returns the standard display to be used. The method first checks, if - * the thread calling this method has an associated display. If so, this - * display is returned. Otherwise the method returns the default display. + * Returns the standard display to be used. The method first checks, if the + * thread calling this method has an associated display. If so, this display + * is returned. Otherwise the method returns the default display. */ public static Display getStandardDisplay() { Display display = Display.getCurrent(); @@ -289,7 +264,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } return display; } - // public static ExternalToolsPlugin getExternalTools() { // return externalTools; // } @@ -299,13 +273,12 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon public static IWorkspace getWorkspace() { return ResourcesPlugin.getWorkspace(); } - public static boolean isDebug() { return getDefault().isDebugging(); } - // public static void logErrorMessage(String message) { - // log(new Status(IStatus.ERROR, getPluginId(), JavaStatusConstants.INTERNAL_ERROR, message, null)); + // log(new Status(IStatus.ERROR, getPluginId(), + // JavaStatusConstants.INTERNAL_ERROR, message, null)); // } // // public static void logErrorStatus(String message, IStatus status) { @@ -313,38 +286,36 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // logErrorMessage(message); // return; // } - // MultiStatus multi= new MultiStatus(getPluginId(), JavaStatusConstants.INTERNAL_ERROR, message, null); + // MultiStatus multi= new MultiStatus(getPluginId(), + // JavaStatusConstants.INTERNAL_ERROR, message, null); // multi.add(status); // log(multi); // } // // public static void log(Throwable e) { - // log(new Status(IStatus.ERROR, getPluginId(), JavaStatusConstants.INTERNAL_ERROR, JavaUIMessages.getString("JavaPlugin.internal_error"), e)); //$NON-NLS-1$ + // log(new Status(IStatus.ERROR, getPluginId(), + // JavaStatusConstants.INTERNAL_ERROR, + // JavaUIMessages.getString("JavaPlugin.internal_error"), e)); //$NON-NLS-1$ // } - public static void log(int severity, String message) { Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null); log(status); } - public static void log(IStatus status) { getDefault().getLog().log(status); } public static void log(Throwable e) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$ + log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, + "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$ } - private static void setJVM() { String osName = System.getProperty("os.name"); - if (osName.startsWith("Mac OS")) { String mrjVersion = System.getProperty("mrj.version"); String majorMRJVersion = mrjVersion.substring(0, 3); jvm = OTHER; try { - double version = Double.valueOf(majorMRJVersion).doubleValue(); - if (version == 2) { jvm = MRJ_2_0; } else if (version >= 2.1 && version < 3) { @@ -354,11 +325,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } else if (version >= 3.1) { jvm = MRJ_3_1; } - } catch (NumberFormatException nfe) { - } - } else if (osName.startsWith("Windows")) { if (osName.indexOf("9") != -1) { jvm = WINDOWS_9x; @@ -367,30 +335,30 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } } } - // TODO: refactor this into a better method name ! public synchronized PHPDocumentProvider getCompilationUnitDocumentProvider() { if (fCompilationUnitDocumentProvider == null) fCompilationUnitDocumentProvider = new PHPDocumentProvider(); return fCompilationUnitDocumentProvider; } - /** * Get the identifier index manager for the given project * - * @param iProject the current project + * @param iProject + * the current project * @return */ public IdentifierIndexManager getIndexManager(IProject iProject) { - String indexFilename = iProject.getLocation() + File.separator + "project.index"; - IdentifierIndexManager indexManager = (IdentifierIndexManager) fIndexManagerMap.get(indexFilename); + String indexFilename = iProject.getLocation() + File.separator + + "project.index"; + IdentifierIndexManager indexManager = (IdentifierIndexManager) fIndexManagerMap + .get(indexFilename); if (indexManager == null) { indexManager = new IdentifierIndexManager(indexFilename); fIndexManagerMap.put(indexFilename, indexManager); } return indexManager; } - public synchronized IWorkingCopyManager getWorkingCopyManager() { if (fWorkingCopyManager == null) { PHPDocumentProvider provider = getCompilationUnitDocumentProvider(); @@ -398,32 +366,27 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } return fWorkingCopyManager; } - - public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { - if (fMembersOrderPreferenceCache == null) - fMembersOrderPreferenceCache= new MembersOrderPreferenceCache(); - return fMembersOrderPreferenceCache; - } - + public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { + if (fMembersOrderPreferenceCache == null) + fMembersOrderPreferenceCache = new MembersOrderPreferenceCache(); + return fMembersOrderPreferenceCache; + } public synchronized ProblemMarkerManager getProblemMarkerManager() { if (fProblemMarkerManager == null) fProblemMarkerManager = new ProblemMarkerManager(); return fProblemMarkerManager; } - public synchronized JavaTextTools getJavaTextTools() { if (fJavaTextTools == null) fJavaTextTools = new JavaTextTools(getPreferenceStore()); return fJavaTextTools; } - public IFile getLastEditorFile() { return fLastEditorFile; } - /** - * Returns the string from the plugin's resource bundle, - * or 'key' if not found. + * Returns the string from the plugin's resource bundle, or 'key' if not + * found. */ // public static String getResourceString(String key) { // ResourceBundle bundle = PHPeclipsePlugin.getDefault().getResourceBundle(); @@ -433,36 +396,33 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // return key; // } // } - /** * Returns the plugin's resource bundle, */ // public ResourceBundle getResourceBundle() { // return resourceBundle; // } - protected void initializeDefaultPreferences(IPreferenceStore store) { // windows preferences: store.setDefault(LOCALHOST_PREF, "http://localhost"); - store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true"); store.setDefault(USE_EXTERNAL_BROWSER_PREF, "false"); store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true"); - String windowsSystem = BootLoader.getWS(); - if (jvm == WINDOWS_9x) { - store.setDefault(EXTERNAL_BROWSER_PREF, "command.com /c start iexplore {0}"); + store.setDefault(EXTERNAL_BROWSER_PREF, + "command.com /c start iexplore {0}"); } else if (windowsSystem.equals(BootLoader.WS_WIN32)) { - store.setDefault(EXTERNAL_BROWSER_PREF, "rundll32 url.dll,FileProtocolHandler {0}"); + store.setDefault(EXTERNAL_BROWSER_PREF, + "rundll32 url.dll,FileProtocolHandler {0}"); } else if (windowsSystem.equals(BootLoader.WS_CARBON)) { // TODO How do we start Safari on Mac OS X ? store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } else { store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } - store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation().toString()); - + store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation() + .toString()); // if ((jvm == WINDOWS_9x) || (jvm == WINDOWS_NT)) { // if (windowsSystem.equals(BootLoader.WS_WIN32)) { @@ -471,53 +431,54 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon store.setDefault(MYSQL_RUN_PREF, "c:\\apache\\mysql\\bin\\mysqld-nt.exe"); store.setDefault(APACHE_RUN_PREF, "c:\\apache\\apache.exe"); } else { - store.setDefault(PHP_RUN_PREF, "/apache/php/php"); store.setDefault(EXTERNAL_PARSER_PREF, "/apache/php/php -l -f {0}"); store.setDefault(MYSQL_RUN_PREF, "/apache/mysql/bin/mysqld"); store.setDefault(APACHE_RUN_PREF, "/apache/apache"); - } store.setDefault(MYSQL_PREF, "--standalone"); store.setDefault(APACHE_START_PREF, "-c \"DocumentRoot \"{0}\"\""); store.setDefault(APACHE_STOP_PREF, "-k shutdown"); store.setDefault(APACHE_RESTART_PREF, "-k restart"); - store.setDefault(MYSQL_START_BACKGROUND, "true"); store.setDefault(APACHE_START_BACKGROUND, "true"); store.setDefault(APACHE_STOP_BACKGROUND, "true"); store.setDefault(APACHE_RESTART_BACKGROUND, "true"); - store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER); store.setDefault(PHP_INTERNAL_PARSER, "false"); store.setDefault(PHP_EXTERNAL_PARSER, "true"); - // store.setDefault(PHP_PARSE_ON_SAVE, "true"); - // show line numbers: // store.setDefault(LINE_NUMBER_RULER, "false"); // store.setDefault(FORMATTER_TAB_SIZE, "4"); - // php syntax highlighting store.setDefault(PHP_USERDEF_XMLFILE, ""); - //assume there is none chooA - - PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, PHPColorProvider.MULTI_LINE_COMMENT); - PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, PHPColorProvider.SINGLE_LINE_COMMENT); + //assume there is none chooA + PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, + PHPColorProvider.MULTI_LINE_COMMENT); + PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, + PHPColorProvider.SINGLE_LINE_COMMENT); PreferenceConverter.setDefault(store, PHP_TAG, PHPColorProvider.TAG); - PreferenceConverter.setDefault(store, PHP_KEYWORD, PHPColorProvider.KEYWORD); - PreferenceConverter.setDefault(store, PHP_VARIABLE, PHPColorProvider.VARIABLE); - PreferenceConverter.setDefault(store, PHP_FUNCTIONNAME, PHPColorProvider.FUNCTION_NAME); - PreferenceConverter.setDefault(store, PHP_CONSTANT, PHPColorProvider.CONSTANT); + PreferenceConverter + .setDefault(store, PHP_KEYWORD, PHPColorProvider.KEYWORD); + PreferenceConverter.setDefault(store, PHP_VARIABLE, + PHPColorProvider.VARIABLE); + PreferenceConverter.setDefault(store, PHP_FUNCTIONNAME, + PHPColorProvider.FUNCTION_NAME); + PreferenceConverter.setDefault(store, PHP_CONSTANT, + PHPColorProvider.CONSTANT); PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE); PreferenceConverter.setDefault(store, PHP_STRING, PHPColorProvider.STRING); - PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); - - PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, PHPColorProvider.PHPDOC_KEYWORD); - PreferenceConverter.setDefault(store, PHPDOC_TAG, PHPColorProvider.PHPDOC_TAG); - PreferenceConverter.setDefault(store, PHPDOC_LINK, PHPColorProvider.PHPDOC_LINK); - PreferenceConverter.setDefault(store, PHPDOC_DEFAULT, PHPColorProvider.PHPDOC_DEFAULT); - + PreferenceConverter + .setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); + PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, + PHPColorProvider.PHPDOC_KEYWORD); + PreferenceConverter.setDefault(store, PHPDOC_TAG, + PHPColorProvider.PHPDOC_TAG); + PreferenceConverter.setDefault(store, PHPDOC_LINK, + PHPColorProvider.PHPDOC_LINK); + PreferenceConverter.setDefault(store, PHPDOC_DEFAULT, + PHPColorProvider.PHPDOC_DEFAULT); // PreferenceConverter.setDefault( // store, // PHP_EDITOR_BACKGROUND, @@ -530,81 +491,70 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // store, // LINE_NUMBER_COLOR, // PHPColorProvider.LINE_NUMBER_COLOR); - // // set default PHPDoc colors: // PreferenceConverter.setDefault( // store, - // PHPDOC_KEYWORD, + // PHPDOC_KEYWORD, // PHPColorProvider.PHPDOC_KEYWORD); // PreferenceConverter.setDefault( // store, - // PHPDOC_LINK, - // PHPColorProvider.PHPDOC_LINK); + // PHPDOC_LINK, + // PHPColorProvider.PHPDOC_LINK); // PreferenceConverter.setDefault( // store, - // PHPDOC_DEFAULT, + // PHPDOC_DEFAULT, // PHPColorProvider.PHPDOC_DEFAULT); // PreferenceConverter.setDefault( // store, - // PHPDOC_TAG, + // PHPDOC_TAG, // PHPColorProvider.PHPDOC_TAG); - // store.setDefault(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, "true"); // PreferenceConverter.setDefault( // store, // PREFERENCE_COLOR_BACKGROUND, // PHPColorProvider.BACKGROUND_COLOR); - //language stuff // store.setDefault(RESOURCE_BUNDLE, LANGUAGE_DEFAULT); // store.setDefault(RESOURCE_BUNDLE_EN_GB, "true"); // store.setDefault(RESOURCE_BUNDLE_DE, "false"); // store.setDefault(RESOURCE_BUNDLE_FR, "false"); // store.setDefault(RESOURCE_BUNDLE_ES, "false"); - store.setDefault(PHP_OUTLINE_CLASS, "true"); //$NON-NLS-1$ store.setDefault(PHP_OUTLINE_FUNC, "true"); //$NON-NLS-1$ store.setDefault(PHP_OUTLINE_VAR, "true"); //$NON-NLS-1$ - TemplatePreferencePage.initDefaults(store); //this will initialize the static fields in the syntaxrdr class new PHPSyntaxRdr(); - - PHPCore.initializeDefaultPluginPreferences(); + JavaCore.initializeDefaultPluginPreferences(); PreferenceConstants.initializeDefaultValues(store); - externalTools.initializeDefaultPreferences(store); } - private IWorkbenchPage internalGetActivePage() { IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); if (window != null) return window.getActivePage(); return null; } - private ImageDescriptorRegistry internalGetImageDescriptorRegistry() { if (fImageDescriptorRegistry == null) fImageDescriptorRegistry = new ImageDescriptorRegistry(); return fImageDescriptorRegistry; } /** - * Open a file in the Workbench that may or may not exist in the workspace. - * Must be run on the UI thread. - * @param filename - * @throws CoreException - */ + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * + * @param filename + * @throws CoreException + */ public ITextEditor openFileInTextEditor(String filename) throws CoreException { - // reject directories if (new File(filename).isDirectory()) return null; - IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getWorkbenchWindows()[0]; IWorkbenchPage page = window.getActivePage(); IPath path = new Path(filename); - // If the file exists in the workspace, open it IFile file = getWorkspace().getRoot().getFileForLocation(path); IEditorPart editor; @@ -625,7 +575,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon IEditorInput input = new ExternalEditorInput(storage); editor = page.openEditor(input, desc.getId()); textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class); - // If the storage provider is not ours, we can't guarantee read/write. if (textEditor != null) { IDocumentProvider documentProvider = textEditor.getDocumentProvider(); @@ -637,81 +586,79 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon return textEditor; } /** - * Open a file in the Workbench that may or may not exist in the workspace. - * Must be run on the UI thread. - * @param filename - * @param line - * @throws CoreException - */ - public void openFileAndGotoLine(String filename, int line) throws CoreException { - + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * + * @param filename + * @param line + * @throws CoreException + */ + public void openFileAndGotoLine(String filename, int line) + throws CoreException { ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a line number was given, go to it if (line > 0) { try { line--; // document is 0 based - IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); - textEditor.selectAndReveal(document.getLineOffset(line), document.getLineLength(line)); - + IDocument document = textEditor.getDocumentProvider().getDocument( + textEditor.getEditorInput()); + textEditor.selectAndReveal(document.getLineOffset(line), document + .getLineLength(line)); } catch (BadLocationException e) { // invalid text position -> do nothing } } } } - /** - * Open a file in the Workbench that may or may not exist in the workspace. - * Must be run on the UI thread. - * @param filename - * @param offset - * @throws CoreException - */ - public void openFileAndGotoOffset(String filename, int offset, int length) throws CoreException { - + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * + * @param filename + * @param offset + * @throws CoreException + */ + public void openFileAndGotoOffset(String filename, int offset, int length) + throws CoreException { ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a line number was given, go to it if (offset >= 0) { - IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); + IDocument document = textEditor.getDocumentProvider().getDocument( + textEditor.getEditorInput()); textEditor.selectAndReveal(offset, length); } } } - - public void openFileAndFindString(String filename, String findString) throws CoreException { - + public void openFileAndFindString(String filename, String findString) + throws CoreException { ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a string was given, go to it if (findString != null) { try { - IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); + IDocument document = textEditor.getDocumentProvider().getDocument( + textEditor.getEditorInput()); int offset = document.search(0, findString, true, false, true); textEditor.selectAndReveal(offset, findString.length()); - } catch (BadLocationException e) { // invalid text position -> do nothing } - } } } public void setLastEditorFile(IFile textEditor) { this.fLastEditorFile = textEditor; } - /** * @see org.eclipse.ui.plugin.AbstractUIPlugin#shutdown() */ public void shutdown() throws CoreException { - // moved down: + // moved down (see below): // super.shutdown(); - // externalTools.shutDown(); ColorManager.getDefault().dispose(); - // save the information from the php index files if necessary Collection collection = fIndexManagerMap.values(); Iterator iterator = collection.iterator(); @@ -720,41 +667,72 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon indexManager = (IdentifierIndexManager) iterator.next(); indexManager.writeFile(); } - if (fImageDescriptorRegistry != null) fImageDescriptorRegistry.dispose(); - // unregisterAdapters(); - super.shutdown(); - if (fWorkingCopyManager != null) { fWorkingCopyManager.shutdown(); fWorkingCopyManager = null; } - if (fCompilationUnitDocumentProvider != null) { fCompilationUnitDocumentProvider.shutdown(); fCompilationUnitDocumentProvider = null; } - if (fJavaTextTools != null) { fJavaTextTools.dispose(); fJavaTextTools = null; } - // JavaDocLocations.shutdownJavadocLocations(); // // JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); - + // begin JavaCore#shutdown() + //savePluginPreferences(); + savePluginPreferences(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + workspace.removeResourceChangeListener(JavaModelManager + .getJavaModelManager().deltaProcessor); + workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault()); + ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); + // end JavaCore#shutdown() } - public void startup() throws CoreException { super.startup(); - IAdapterManager manager = Platform.getAdapterManager(); - manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class); - manager.registerAdapters(new ResourceAdapterFactory(), IResource.class); - // externalTools.startUp(); + // begin JavaCore.startup(); + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + try { + manager.configurePluginDebugOptions(); + // request state folder creation (workaround 19885) + // JavaCore.getPlugin().getStateLocation(); + getStateLocation(); + // retrieve variable values + // JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new + // JavaModelManager.PluginPreferencesListener()); + getPluginPreferences().addPropertyChangeListener( + new JavaModelManager.PluginPreferencesListener()); + // TODO khartlage temp-del + // manager.loadVariablesAndContainers(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + workspace.addResourceChangeListener(manager.deltaProcessor, + IResourceChangeEvent.PRE_AUTO_BUILD + | IResourceChangeEvent.POST_AUTO_BUILD + | IResourceChangeEvent.POST_CHANGE + | IResourceChangeEvent.PRE_DELETE + | IResourceChangeEvent.PRE_CLOSE); + // startIndexing(); + workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager); + } catch (CoreException e) { + } catch (RuntimeException e) { + manager.shutdown(); + throw e; + } + // end JavaCore.startup(); + IAdapterManager platformManager = Platform.getAdapterManager(); + platformManager.registerAdapters(new PHPElementAdapterFactory(), + PHPElement.class); + platformManager.registerAdapters(new ResourceAdapterFactory(), + IResource.class); + // externalTools.startUp(); getStandardDisplay().asyncExec(new Runnable() { public void run() { //initialize the variable context manager @@ -762,5 +740,4 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } }); } - } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java index 65b7e5d..c5e2f9d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java @@ -14,20 +14,17 @@ package net.sourceforge.phpeclipse.phpeditor; import java.util.Iterator; -import org.eclipse.core.resources.IMarker; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.ui.texteditor.MarkerAnnotation; - import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.JavaCore; - import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil; +import org.eclipse.core.resources.IMarker; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.texteditor.MarkerAnnotation; + public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnotation { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java index b6d1eb1..d72d62c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java @@ -28,6 +28,7 @@ import net.sourceforge.phpdt.core.ISourceRange; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup; import net.sourceforge.phpdt.internal.ui.dnd.JdtViewerDragAdapter; @@ -43,7 +44,6 @@ import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.ProblemsLabelDecorator.ProblemsLabelChangedEvent; import net.sourceforge.phpdt.ui.actions.GenerateActionGroup; import net.sourceforge.phpdt.ui.actions.MemberFilterActionGroup; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IResource; @@ -298,7 +298,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt public void dispose() { if (fListener != null) { - PHPCore.removeElementChangedListener(fListener); + JavaCore.removeElementChangedListener(fListener); fListener= null; } } @@ -311,9 +311,9 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (isCU && fListener == null) { fListener= new ElementChangedListener(); - PHPCore.addElementChangedListener(fListener); + JavaCore.addElementChangedListener(fListener); } else if (!isCU && fListener != null) { - PHPCore.removeElementChangedListener(fListener); + JavaCore.removeElementChangedListener(fListener); fListener= null; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java index 6e01d7b..c01b0de 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java @@ -17,8 +17,6 @@ import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds; -import net.sourceforge.phpdt.ui.PreferenceConstants; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; import org.eclipse.jface.text.IDocument; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java index a79460d..ec23358 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java @@ -26,13 +26,13 @@ import net.sourceforge.phpdt.core.IJavaModelStatusConstants; import net.sourceforge.phpdt.core.IOpenable; import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.ui.PHPStatusConstants; import net.sourceforge.phpdt.internal.ui.PHPUIStatus; import net.sourceforge.phpdt.internal.ui.text.java.IProblemRequestorExtension; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; @@ -937,7 +937,7 @@ public class PHPDocumentProvider extends FileDocumentProvider { * @param file the file from which to create the compilation unit */ protected ICompilationUnit createCompilationUnit(IFile file) { - Object element = PHPCore.create(file); + Object element = JavaCore.create(file); if (element instanceof ICompilationUnit) return (ICompilationUnit) element; return null; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index 47c1963..e6a298c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -25,6 +25,7 @@ import net.sourceforge.phpdt.core.IMember; import net.sourceforge.phpdt.core.ISourceRange; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup; import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher; @@ -35,7 +36,6 @@ import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.actions.GenerateActionGroup; import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.php.IPHPPartitionScannerConstants; @@ -1123,7 +1123,7 @@ public abstract class PHPEditor extends ExtendedTextEditor implements IViewPart /** Preference key for the link color */ private final static String LINK_COLOR = PreferenceConstants.EDITOR_LINK_COLOR; /** Preference key for compiler task tags */ - private final static String COMPILER_TASK_TAGS = PHPCore.COMPILER_TASK_TAGS; + private final static String COMPILER_TASK_TAGS = JavaCore.COMPILER_TASK_TAGS; // protected PHPActionGroup fActionGroups; // /** The outline page */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java index 627a046..b8ab839 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java @@ -11,6 +11,8 @@ **********************************************************************/ package net.sourceforge.phpeclipse.phpeditor; import java.util.Vector; + +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference; import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; import net.sourceforge.phpdt.internal.ui.text.JavaAnnotationHover; @@ -24,7 +26,6 @@ import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverProx import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCompletionProcessor; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.html.HTMLFormattingStrategy; import net.sourceforge.phpeclipse.phpeditor.php.HTMLCompletionProcessor; @@ -423,7 +424,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { // prefix[0] is either '\t' or ' ' x tabWidth, depending on useSpaces final IPreferenceStore preferences = PHPeclipsePlugin.getDefault() .getPreferenceStore(); - int tabWidth = preferences.getInt(PHPCore.FORMATTER_TAB_SIZE); + int tabWidth = preferences.getInt(JavaCore.FORMATTER_TAB_SIZE); boolean useSpaces = getPreferenceStore().getBoolean(SPACES_FOR_TABS); for (int i = 0; i <= tabWidth; i++) { StringBuffer prefix = new StringBuffer(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java index 419fd01..d8c935d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java @@ -11,6 +11,7 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.ISourceRange; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference; import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher; @@ -20,7 +21,6 @@ import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI.ExitFlags; import net.sourceforge.phpdt.ui.IWorkingCopyManager; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.php.IPHPPartitionScannerConstants; @@ -867,7 +867,7 @@ public class PHPUnitEditor extends PHPEditor { // } // } /* Preference key for code formatter tab size */ - private final static String CODE_FORMATTER_TAB_SIZE = PHPCore.FORMATTER_TAB_SIZE; + private final static String CODE_FORMATTER_TAB_SIZE = JavaCore.FORMATTER_TAB_SIZE; /** Preference key for matching brackets */ private final static String MATCHING_BRACKETS = PreferenceConstants.EDITOR_MATCHING_BRACKETS; /** Preference key for matching brackets color */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java index e288032..4a5799c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java @@ -1,7 +1,7 @@ package net.sourceforge.phpeclipse.resourcesview; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.JavaProject; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -17,17 +17,17 @@ public class ResourceAdapterFactory implements IAdapterFactory { public Object getAdapter(Object adaptableObject, Class adapterType) { if (PHPFile.class.equals(adapterType)) - return PHPCore.create((IFile) adaptableObject); + return JavaCore.create((IFile) adaptableObject); if (JavaProject.class.equals(adapterType)) - return PHPCore.create((IProject) adaptableObject); + return JavaCore.create((IProject) adaptableObject); if (PHPElement.class.equals(adapterType)) { if (adaptableObject instanceof IFile) - return PHPCore.create((IFile) adaptableObject); + return JavaCore.create((IFile) adaptableObject); if (adaptableObject instanceof IProject) - return PHPCore.create((IProject) adaptableObject); + return JavaCore.create((IProject) adaptableObject); } return null; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java index 4378e2f..cbeca0a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java @@ -2,7 +2,7 @@ package net.sourceforge.phpeclipse.wizards; import java.lang.reflect.InvocationTargetException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IProject; @@ -73,7 +73,7 @@ public class NewProjectCreationWizard extends BasicNewResourceWizard implements newProject.open(new SubProgressMonitor(monitor, 1)); remainingWorkUnits--; } - PHPCore.addPHPNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits)); + JavaCore.addPHPNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits)); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java index ec03535..caff19b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java @@ -2,8 +2,8 @@ package net.sourceforge.phpeclipse.wizards; import java.lang.reflect.InvocationTargetException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; @@ -83,7 +83,7 @@ public class TempnewPHPProject extends BasicNewResourceWizard implements INewWiz project.open(monitor); monitor= null; } - PHPCore.addPHPNature(project, new NullProgressMonitor()); + JavaCore.addPHPNature(project, new NullProgressMonitor()); } finally { if (monitor != null) { monitor.done();