1 package net.sourceforge.phpdt.core;
 
   4 import java.util.ArrayList;
 
   5 import java.util.Collection;
 
   6 import java.util.Enumeration;
 
   7 import java.util.HashSet;
 
   8 import java.util.Hashtable;
 
  12 import net.sourceforge.phpdt.internal.core.BatchOperation;
 
  13 import net.sourceforge.phpdt.internal.core.BufferManager;
 
  14 import net.sourceforge.phpdt.internal.core.ClasspathEntry;
 
  15 import net.sourceforge.phpdt.internal.core.JavaModel;
 
  16 import net.sourceforge.phpdt.internal.core.JavaModelManager;
 
  17 import net.sourceforge.phpdt.internal.core.Region;
 
  18 import net.sourceforge.phpdt.internal.corext.Assert;
 
  19 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 
  21 import org.eclipse.core.resources.IFile;
 
  22 import org.eclipse.core.resources.IFolder;
 
  23 import org.eclipse.core.resources.IMarker;
 
  24 import org.eclipse.core.resources.IMarkerDelta;
 
  25 import org.eclipse.core.resources.IProject;
 
  26 import org.eclipse.core.resources.IProjectDescription;
 
  27 import org.eclipse.core.resources.IResource;
 
  28 import org.eclipse.core.resources.IResourceChangeEvent;
 
  29 import org.eclipse.core.resources.ISavedState;
 
  30 import org.eclipse.core.resources.IWorkspace;
 
  31 import org.eclipse.core.resources.IWorkspaceRoot;
 
  32 import org.eclipse.core.resources.IWorkspaceRunnable;
 
  33 import org.eclipse.core.resources.ResourcesPlugin;
 
  34 import org.eclipse.core.runtime.CoreException;
 
  35 import org.eclipse.core.runtime.IConfigurationElement;
 
  36 import org.eclipse.core.runtime.IPath;
 
  37 import org.eclipse.core.runtime.IProgressMonitor;
 
  38 import org.eclipse.core.runtime.IStatus;
 
  39 import org.eclipse.core.runtime.Plugin;
 
  40 import org.eclipse.core.runtime.Preferences;
 
  41 import org.eclipse.core.runtime.Status;
 
  42 import org.eclipse.core.runtime.jobs.Job;
 
  43 import net.sourceforge.phpdt.internal.core.util.Util;
 
  44 import org.osgi.framework.BundleContext;
 
  46 public class JavaCore {
 
  48 //  public static HashSet OptionNames = new HashSet(20);
 
  50    * The plug-in identifier of the Java core support
 
  51    * (value <code>"net.sourceforge.phpeclipse"</code>)
 
  53 //  public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core"; //$NON-NLS-1$
 
  54         public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID;
 
  56      * Possible  configurable option ID.
 
  57      * @see #getDefaultOptions
 
  60   public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$
 
  63      * Possible  configurable option ID.
 
  64      * @see #getDefaultOptions
 
  67   public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$
 
  69    * Possible  configurable option ID.
 
  70    * @see #getDefaultOptions
 
  73   public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$
 
  75    * Possible  configurable option ID.
 
  76    * @see #getDefaultOptions
 
  79   public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$
 
  81    * Possible  configurable option ID.
 
  82    * @see #getDefaultOptions
 
  85   public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$
 
  87    * Possible  configurable option ID.
 
  88    * @see #getDefaultOptions
 
  91   public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$
 
  93    * Possible  configurable option ID.
 
  94    * @see #getDefaultOptions
 
  97   public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$
 
  99    * Possible  configurable option ID.
 
 100    * @see #getDefaultOptions
 
 103   public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$
 
 105    * Possible  configurable option ID.
 
 106    * @see #getDefaultOptions
 
 109   public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$
 
 111    * Possible  configurable option ID.
 
 112    * @see #getDefaultOptions
 
 115   public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$
 
 117    * Possible  configurable option value.
 
 118    * @see #getDefaultOptions
 
 121   public static final String INSERT = "insert"; //$NON-NLS-1$
 
 123    * Possible  configurable option value.
 
 124    * @see #getDefaultOptions
 
 127   public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$
 
 130    * Possible  configurable option value.
 
 131    * @see #getDefaultOptions
 
 134   public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$
 
 136    * Possible  configurable option value.
 
 137    * @see #getDefaultOptions
 
 140   public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$
 
 142    * Possible  configurable option value.
 
 143    * @see #getDefaultOptions
 
 146   public static final String NORMAL = "normal"; //$NON-NLS-1$
 
 148    * Possible  configurable option value.
 
 149    * @see #getDefaultOptions
 
 152   public static final String COMPACT = "compact"; //$NON-NLS-1$
 
 154    * Possible  configurable option value.
 
 155    * @see #getDefaultOptions
 
 158   public static final String TAB = "tab"; //$NON-NLS-1$
 
 160    * Possible  configurable option value.
 
 161    * @see #getDefaultOptions
 
 164   public static final String SPACE = "space"; //$NON-NLS-1$
 
 166    * Possible  configurable option value.
 
 167    * @see #getDefaultOptions
 
 170   public static final String ENABLED = "enabled"; //$NON-NLS-1$
 
 172    * Possible  configurable option value.
 
 173    * @see #getDefaultOptions
 
 176   public static final String DISABLED = "disabled"; //$NON-NLS-1$
 
 178    * Possible  configurable option value.
 
 179    * @see #getDefaultOptions
 
 182   public static final String CLEAN = "clean"; //$NON-NLS-1$
 
 185          * Possible  configurable option ID.
 
 186          * @see #getDefaultOptions
 
 189   public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$
 
 192                  * Name of the handle id attribute in a Java marker.
 
 194                 protected static final String ATT_HANDLE_ID =
 
 195                         "net.sourceforge.phpdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$
 
 197                 // *************** Possible IDs for configurable options. ********************
 
 200                  * Possible  configurable option ID.
 
 201                  * @see #getDefaultOptions()
 
 203                 public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$
 
 205                  * Possible  configurable option ID.
 
 206                  * @see #getDefaultOptions()
 
 208                 public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$
 
 210                  * Possible  configurable option ID.
 
 211                  * @see #getDefaultOptions
 
 213                 public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$
 
 215                  * Possible  configurable option ID.
 
 216                  * @see #getDefaultOptions
 
 218                 public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$
 
 220                  * Possible  configurable option ID.
 
 221                  * @see #getDefaultOptions
 
 223                 public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$
 
 226                  * Possible  configurable option ID.
 
 227                  * @see #getDefaultOptions
 
 229                 public static final String COMPILER_PB_PHP_VAR_DEPRECATED = PLUGIN_ID + ".compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$
 
 232                  * Possible  configurable option ID.
 
 233                  * @see #getDefaultOptions
 
 235                 public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
 
 237                  * Possible  configurable option ID.
 
 238                  * @see #getDefaultOptions
 
 240                 public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$
 
 242                  * Possible  configurable option ID.
 
 243                  * @see #getDefaultOptions
 
 245                 public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
 
 247                  * Possible  configurable option ID.
 
 248                  * @see #getDefaultOptions
 
 250                 public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
 
 253                  * Possible  configurable option ID.
 
 254                  * @see #getDefaultOptions
 
 256                 public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$
 
 258                  * Possible  configurable option ID.
 
 259                  * @see #getDefaultOptions
 
 262                 public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
 
 264                  * Possible  configurable option ID.
 
 265                  * @see #getDefaultOptions
 
 267                 public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
 
 269                  * Possible  configurable option ID.
 
 270                  * @see #getDefaultOptions
 
 272                 public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$
 
 274                  * Possible  configurable option ID.
 
 275                  * @see #getDefaultOptions
 
 277                 public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$
 
 279                  * Possible  configurable option ID.
 
 280                  * @see #getDefaultOptions
 
 283                 public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
 
 285                  * Possible  configurable option ID.
 
 286                  * @see #getDefaultOptions
 
 289                 public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
 
 291                  * Possible  configurable option ID.
 
 292                  * @see #getDefaultOptions
 
 295                 public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$
 
 297                  * Possible  configurable option ID.
 
 298                  * @see #getDefaultOptions
 
 300                 public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
 
 302                  * Possible  configurable option ID.
 
 303                  * @see #getDefaultOptions
 
 306                 public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
 
 308                  * Possible  configurable option ID.
 
 309                  * @see #getDefaultOptions
 
 312                 public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$
 
 314                  * Possible  configurable option ID.
 
 315                  * @see #getDefaultOptions
 
 318                 public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
 
 320                  * Possible  configurable option ID.
 
 321                  * @see #getDefaultOptions
 
 324                 public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$
 
 326                  * Possible  configurable option ID.
 
 327                  * @see #getDefaultOptions
 
 330                 public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
 
 332                  * Possible  configurable option ID.
 
 333                  * @see #getDefaultOptions
 
 336                 public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
 
 338                  * Possible  configurable option ID.
 
 339                  * @see #getDefaultOptions
 
 342                 public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
 
 344                  * Possible  configurable option ID.
 
 345                  * @see #getDefaultOptions
 
 348                 public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$
 
 350                  * Possible  configurable option ID.
 
 351                  * @see #getDefaultOptions
 
 354                 public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$
 
 356                  * Possible  configurable option ID.
 
 357                  * @see #getDefaultOptions
 
 360                 public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$
 
 362                  * Possible  configurable option ID.
 
 363                  * @see #getDefaultOptions
 
 366                 public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$
 
 368                  * Possible  configurable option value for COMPILER_TASK_PRIORITIES.
 
 369                  * @see #getDefaultOptions
 
 372                 public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$
 
 374                  * Possible  configurable option value for COMPILER_TASK_PRIORITIES.
 
 375                  * @see #getDefaultOptions
 
 378                 public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$
 
 380                  * Possible  configurable option value for COMPILER_TASK_PRIORITIES.
 
 381                  * @see #getDefaultOptions
 
 384                 public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$
 
 386                  * Possible  configurable option ID.
 
 387                  * @see #getDefaultOptions
 
 389                 public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$
 
 391                  * Possible  configurable option ID.
 
 392                  * @see #getDefaultOptions
 
 395                 public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$
 
 397                  * Possible  configurable option ID.
 
 398                  * @see #getDefaultOptions
 
 401                 public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$
 
 403                  * Possible  configurable option ID.
 
 404                  * @see #getDefaultOptions
 
 407                 public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$                
 
 409                  * Possible  configurable option ID.
 
 410                  * @see #getDefaultOptions
 
 413                 public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$
 
 415                  * Possible  configurable option ID.
 
 416                  * @see #getDefaultOptions
 
 419                 public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$
 
 421                  * Possible  configurable option ID.
 
 422                  * @see #getDefaultOptions
 
 425                 public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$
 
 427                  * Possible  configurable option ID.
 
 428                  * @see #getDefaultOptions
 
 431                 public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$
 
 433                  * Possible  configurable option ID.
 
 434                  * @see #getDefaultOptions
 
 437                 public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$
 
 442                 public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
 
 444                  * Default task priority
 
 447                 public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$
 
 449                  * Possible configurable option ID
 
 450                  * @see #getDefaultOptions
 
 453                 public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$
 
 455                  * Possible  configurable option ID.
 
 456                  * @see #getDefaultOptions
 
 459                 public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$
 
 461                  * Possible  configurable option ID.
 
 462                  * @see #getDefaultOptions
 
 465                 public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$
 
 467                  * Possible  configurable option ID.
 
 468                  * @see #getDefaultOptions
 
 471                 public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$
 
 473                  * Possible  configurable option ID.
 
 474                  * @see #getDefaultOptions
 
 477                 public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
 
 479                  * Possible  configurable option ID.
 
 480                  * @see #getDefaultOptions
 
 483                 public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$
 
 485                  * Possible  configurable option ID.
 
 486                  * @see #getDefaultOptions
 
 489                 public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$
 
 491                  * Possible  configurable option ID.
 
 492                  * @see #getDefaultOptions
 
 495                 public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$
 
 497                  * Possible  configurable option ID.
 
 498                  * @see #getDefaultOptions
 
 501                 public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
 
 503                  * Possible  configurable option ID.
 
 504                  * @see #getDefaultOptions
 
 507                 public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$
 
 509                  * Possible  configurable option ID.
 
 510                  * @see #getDefaultOptions
 
 513                 public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$
 
 515                 // *************** Possible values for configurable options. ********************
 
 518                  * Possible  configurable option value.
 
 519                  * @see #getDefaultOptions
 
 521                 public static final String GENERATE = "generate"; //$NON-NLS-1$
 
 523                  * Possible  configurable option value.
 
 524                  * @see #getDefaultOptions
 
 526                 public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$
 
 528                  * Possible  configurable option value.
 
 529                  * @see #getDefaultOptions
 
 531                 public static final String PRESERVE = "preserve"; //$NON-NLS-1$
 
 533                  * Possible  configurable option value.
 
 534                  * @see #getDefaultOptions
 
 536                 public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$
 
 538                  * Possible  configurable option value.
 
 539                  * @see #getDefaultOptions
 
 541                 public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$
 
 543                  * Possible  configurable option value.
 
 544                  * @see #getDefaultOptions
 
 546                 public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$
 
 548                  * Possible  configurable option value.
 
 549                  * @see #getDefaultOptions
 
 552                 public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
 
 554                  * Possible  configurable option value.
 
 555                  * @see #getDefaultOptions
 
 558                 public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
 
 560                  * Possible  configurable option value.
 
 561                  * @see #getDefaultOptions
 
 564                 public static final String ABORT = "abort"; //$NON-NLS-1$
 
 566                  * Possible  configurable option value.
 
 567                  * @see #getDefaultOptions
 
 569                 public static final String ERROR = "error"; //$NON-NLS-1$
 
 571                  * Possible  configurable option value.
 
 572                  * @see #getDefaultOptions
 
 574                 public static final String WARNING = "warning"; //$NON-NLS-1$
 
 576                  * Possible  configurable option value.
 
 577                  * @see #getDefaultOptions
 
 579                 public static final String IGNORE = "ignore"; //$NON-NLS-1$
 
 581                  * Possible  configurable option value.
 
 582                  * @see #getDefaultOptions
 
 584                 public static final String COMPUTE = "compute"; //$NON-NLS-1$
 
 586                  * Possible  configurable option value.
 
 587                  * @see #getDefaultOptions
 
 593    * Returns a table of all known configurable options with their default values.
 
 594    * These options allow to configure the behaviour of the underlying components.
 
 595    * The client may safely use the result as a template that they can modify and
 
 596    * then pass to <code>setOptions</code>.
 
 598    * Helper constants have been defined on JavaCore for each of the option ID and 
 
 599    * their possible constant values.
 
 601    * Note: more options might be added in further releases.
 
 603    * RECOGNIZED OPTIONS:
 
 604    * COMPILER / Generating Local Variable Debug Attribute
 
 605    *    When generated, this attribute will enable local variable names 
 
 606    *    to be displayed in debugger, only in place where variables are 
 
 607    *    definitely assigned (.class file is then bigger)
 
 608    *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
 
 609    *     - possible values:   { "generate", "do not generate" }
 
 610    *     - default:           "generate"
 
 612    * COMPILER / Generating Line Number Debug Attribute 
 
 613    *    When generated, this attribute will enable source code highlighting in debugger 
 
 614    *    (.class file is then bigger).
 
 615    *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
 
 616    *     - possible values:   { "generate", "do not generate" }
 
 617    *     - default:           "generate"
 
 619    * COMPILER / Generating Source Debug Attribute 
 
 620    *    When generated, this attribute will enable the debugger to present the 
 
 621    *    corresponding source code.
 
 622    *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
 
 623    *     - possible values:   { "generate", "do not generate" }
 
 624    *     - default:           "generate"
 
 626    * COMPILER / Preserving Unused Local Variables
 
 627    *    Unless requested to preserve unused local variables (i.e. never read), the 
 
 628    *    compiler will optimize them out, potentially altering debugging
 
 629    *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
 
 630    *     - possible values:   { "preserve", "optimize out" }
 
 631    *     - default:           "preserve"
 
 633    * COMPILER / Defining Target Java Platform
 
 634    *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
 
 635    *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
 
 636    *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
 
 637    *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
 
 640    * COMPILER / Reporting Unreachable Code
 
 641    *    Unreachable code can optionally be reported as an error, warning or simply 
 
 642    *    ignored. The bytecode generation will always optimized it out.
 
 643    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
 
 644    *     - possible values:   { "error", "warning", "ignore" }
 
 647    * COMPILER / Reporting Invalid Import
 
 648    *    An import statement that cannot be resolved might optionally be reported 
 
 649    *    as an error, as a warning or ignored.
 
 650    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
 
 651    *     - possible values:   { "error", "warning", "ignore" }
 
 654    * COMPILER / Reporting Attempt to Override Package-Default Method
 
 655    *    A package default method is not visible in a different package, and thus 
 
 656    *    cannot be overridden. When enabling this option, the compiler will signal 
 
 657    *    such scenarii either as an error or a warning.
 
 658    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
 
 659    *     - possible values:   { "error", "warning", "ignore" }
 
 660    *     - default:           "warning"
 
 662    * COMPILER / Reporting Method With Constructor Name
 
 663    *    Naming a method with a constructor name is generally considered poor 
 
 664    *    style programming. When enabling this option, the compiler will signal such 
 
 665    *    scenarii either as an error or a warning.
 
 666    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
 
 667    *     - possible values:   { "error", "warning", "ignore" }
 
 668    *     - default:           "warning"
 
 670    * COMPILER / Reporting Deprecation
 
 671    *    When enabled, the compiler will signal use of deprecated API either as an 
 
 672    *    error or a warning.
 
 673    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
 
 674    *     - possible values:   { "error", "warning", "ignore" }
 
 675    *     - default:           "warning"
 
 677    * COMPILER / Reporting Deprecation Inside Deprecated Code
 
 678    *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
 
 679    *    The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
 
 680    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
 
 681    *     - possible values:   { "enabled", "disabled" }
 
 682    *     - default:           "disabled"
 
 684    * COMPILER / Reporting Hidden Catch Block
 
 685    *    Locally to a try statement, some catch blocks may hide others , e.g.
 
 686    *      try {  throw new java.io.CharConversionException();
 
 687    *      } catch (java.io.CharConversionException e) {
 
 688    *      } catch (java.io.IOException e) {}. 
 
 689    *    When enabling this option, the compiler will issue an error or a warning for hidden 
 
 690    *    catch blocks corresponding to checked exceptions
 
 691    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
 
 692    *     - possible values:   { "error", "warning", "ignore" }
 
 693    *     - default:           "warning"
 
 695    * COMPILER / Reporting Unused Local
 
 696    *    When enabled, the compiler will issue an error or a warning for unused local 
 
 697    *    variables (i.e. variables never read from)
 
 698    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
 
 699    *     - possible values:   { "error", "warning", "ignore" }
 
 700    *     - default:           "ignore"
 
 702    * COMPILER / Reporting Unused Parameter
 
 703    *    When enabled, the compiler will issue an error or a warning for unused method 
 
 704    *    parameters (i.e. parameters never read from)
 
 705    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
 
 706    *     - possible values:   { "error", "warning", "ignore" }
 
 707    *     - default:           "ignore"
 
 709    * COMPILER / Reporting Unused Import
 
 710    *    When enabled, the compiler will issue an error or a warning for unused import 
 
 712    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
 
 713    *     - possible values:   { "error", "warning", "ignore" }
 
 714    *     - default:           "warning"
 
 716    * COMPILER / Reporting Synthetic Access Emulation
 
 717    *    When enabled, the compiler will issue an error or a warning whenever it emulates 
 
 718    *    access to a non-accessible member of an enclosing type. Such access can have
 
 719    *    performance implications.
 
 720    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
 
 721    *     - possible values:   { "error", "warning", "ignore" }
 
 722    *     - default:           "ignore"
 
 724    * COMPILER / Reporting Non-Externalized String Literal
 
 725    *    When enabled, the compiler will issue an error or a warning for non externalized 
 
 726    *    String literal (i.e. non tagged with //$NON-NLS-<n>$). 
 
 727    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
 
 728    *     - possible values:   { "error", "warning", "ignore" }
 
 729    *     - default:           "ignore"
 
 731    * COMPILER / Reporting Usage of 'assert' Identifier
 
 732    *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
 
 733    *    used as an identifier (reserved keyword in 1.4)
 
 734    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
 
 735    *     - possible values:   { "error", "warning", "ignore" }
 
 736    *     - default:           "ignore"
 
 738    * COMPILER / Reporting Usage of expression receiver on static invocation/field access
 
 739    *    When enabled, the compiler will issue an error or a warning whenever a static field
 
 740    *    or method is accessed with an expression receiver.
 
 741    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
 
 742    *     - possible values:   { "error", "warning", "ignore" }
 
 743    *     - default:           "warning"
 
 745    * COMPILER / Reporting Assignment with no effect
 
 746    *    When enabled, the compiler will issue an error or a warning whenever an assignment
 
 747    *    has no effect (e.g 'x = x').
 
 748    *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
 
 749    *     - possible values:   { "error", "warning", "ignore" }
 
 750    *     - default:           "warning"
 
 752    * COMPILER / Setting Source Compatibility Mode
 
 753    *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
 
 754    *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
 
 755    *   level should be set to "1.4" and the compliance mode should be "1.4".
 
 756    *     - option id:         "org.phpeclipse.phpdt.core.compiler.source"
 
 757    *     - possible values:   { "1.3", "1.4" }
 
 760    * COMPILER / Setting Compliance Level
 
 761    *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
 
 762    *    should not go beyond "1.3" level.
 
 763    *     - option id:         "org.phpeclipse.phpdt.core.compiler.compliance"
 
 764    *     - possible values:   { "1.3", "1.4" }
 
 767    * COMPILER / Maximum number of problems reported per compilation unit
 
 768    *    Specify the maximum number of problems reported on each compilation unit.
 
 769    *     - option id:         "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
 
 770    *     - possible values:     "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
 
 773    * COMPILER / Define the Automatic Task Tags
 
 774    *    When the tag is non empty, the compiler will issue a task marker whenever it encounters
 
 775    *    one of the corresponding tag inside any comment in Java source code.
 
 776    *    Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
 
 777    *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskTags"
 
 778    *     - possible values:   { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card 
 
 780    * COMPILER / Define the Automatic Task Priorities
 
 781    *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
 
 782    *    of the task markers issued by the compiler.
 
 783    *    If the default is specified, the priority of each task marker is "NORMAL".
 
 784    *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskPriorities"
 
 785    *     - possible values:   { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
 
 788    * BUILDER / Specifying Filters for Resource Copying Control
 
 789    *    Allow to specify some filters to control the resource copy process.
 
 790    *     - option id:         "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
 
 791    *     - possible values:   { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
 
 792    *       or the name of a folder which ends with '/'
 
 795    * BUILDER / Abort if Invalid Classpath
 
 796    *    Allow to toggle the builder to abort if the classpath is invalid
 
 797    *     - option id:         "org.phpeclipse.phpdt.core.builder.invalidClasspath"
 
 798    *     - possible values:   { "abort", "ignore" }
 
 799    *     - default:           "ignore"
 
 801    * BUILDER / Cleaning Output Folder(s)
 
 802    *    Indicate whether the JavaBuilder is allowed to clean the output folders
 
 803    *    when performing full build operations.
 
 804    *     - option id:         "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
 
 805    *     - possible values:   { "clean", "ignore" }
 
 808    * JAVACORE / Computing Project Build Order
 
 809    *    Indicate whether JavaCore should enforce the project build order to be based on
 
 810    *    the classpath prerequisite chain. When requesting to compute, this takes over
 
 811    *    the platform default order (based on project references).
 
 812    *     - option id:         "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
 
 813    *     - possible values:   { "compute", "ignore" }
 
 814    *     - default:           "ignore"   
 
 816    * JAVACORE / Specify Default Source Encoding Format
 
 817    *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
 
 818    *    to 'ResourcesPlugin.getEncoding()'.
 
 819    *     - option id:         "org.phpeclipse.phpdt.core.encoding"
 
 820    *     - possible values:   { any of the supported encoding name}.
 
 821    *     - default:           <platform default>
 
 823    * JAVACORE / Reporting Incomplete Classpath
 
 824    *    An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
 
 825    *     - option id:         "org.phpeclipse.phpdt.core.incompleteClasspath"
 
 826    *     - possible values:   { "error", "warning"}
 
 829    * JAVACORE / Reporting Classpath Cycle
 
 830    *    A project is involved in a cycle.
 
 831    *     - option id:         "org.phpeclipse.phpdt.core.circularClasspath"
 
 832    *     - possible values:   { "error", "warning" }
 
 835    *    FORMATTER / Inserting New Line Before Opening Brace
 
 836    *    When Insert, a new line is inserted before an opening brace, otherwise nothing
 
 838    *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
 
 839    *     - possible values:   { "insert", "do not insert" }
 
 840    *     - default:           "do not insert"
 
 842    *    FORMATTER / Inserting New Line Inside Control Statement
 
 843    *    When Insert, a new line is inserted between } and following else, catch, finally
 
 844    *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
 
 845    *     - possible values:   { "insert", "do not insert" }
 
 846    *     - default:           "do not insert"
 
 848    *    FORMATTER / Clearing Blank Lines
 
 849    *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
 
 850    *    and all others removed.
 
 851    *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
 
 852    *     - possible values:   { "clear all", "preserve one" }
 
 853    *     - default:           "preserve one"
 
 855    *    FORMATTER / Inserting New Line Between Else/If 
 
 856    *    When Insert, a blank line is inserted between an else and an if when they are 
 
 857    *    contiguous. When choosing to not insert, else-if will be kept on the same
 
 858    *    line when possible.
 
 859    *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
 
 860    *     - possible values:   { "insert", "do not insert" }
 
 861    *     - default:           "do not insert"
 
 863    *    FORMATTER / Inserting New Line In Empty Block
 
 864    *    When insert, a line break is inserted between contiguous { and }, if } is not followed
 
 866    *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
 
 867    *     - possible values:   { "insert", "do not insert" }
 
 868    *     - default:           "insert"
 
 870    *    FORMATTER / Splitting Lines Exceeding Length
 
 871    *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
 
 872    *    disable line splitting
 
 873    *     - option id:         "org.phpeclipse.phpdt.core.formatter.lineSplit"
 
 874    *     - possible values:     "<n>", where n is zero or a positive integer
 
 877    *    FORMATTER / Compacting Assignment
 
 878    *    Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
 
 879    *    is inserted before the assignment operator
 
 880    *     - option id:         "org.phpeclipse.phpdt.core.formatter.style.assignment"
 
 881    *     - possible values:   { "compact", "normal" }
 
 882    *     - default:           "normal"
 
 884    *    FORMATTER / Defining Indentation Character
 
 885    *    Either choose to indent with tab characters or spaces
 
 886    *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.char"
 
 887    *     - possible values:   { "tab", "space" }
 
 890    *    FORMATTER / Defining Space Indentation Length
 
 891    *    When using spaces, set the amount of space characters to use for each 
 
 893    *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.size"
 
 894    *     - possible values:     "<n>", where n is a positive integer
 
 897    *    CODEASSIST / Activate Visibility Sensitive Completion
 
 898    *    When active, completion doesn't show that you can not see
 
 899    *    (e.g. you can not see private methods of a super class).
 
 900    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
 
 901    *     - possible values:   { "enabled", "disabled" }
 
 902    *     - default:           "disabled"
 
 904    *    CODEASSIST / Automatic Qualification of Implicit Members
 
 905    *    When active, completion automatically qualifies completion on implicit
 
 906    *    field references and message expressions.
 
 907    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
 
 908    *     - possible values:   { "enabled", "disabled" }
 
 909    *     - default:           "disabled"
 
 911    *  CODEASSIST / Define the Prefixes for Field Name
 
 912    *    When the prefixes is non empty, completion for field name will begin with
 
 913    *    one of the proposed prefixes.
 
 914    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
 
 915    *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
 918    *  CODEASSIST / Define the Prefixes for Static Field Name
 
 919    *    When the prefixes is non empty, completion for static field name will begin with
 
 920    *    one of the proposed prefixes.
 
 921    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
 
 922    *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
 925    *  CODEASSIST / Define the Prefixes for Local Variable Name
 
 926    *    When the prefixes is non empty, completion for local variable name will begin with
 
 927    *    one of the proposed prefixes.
 
 928    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
 
 929    *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
 932    *  CODEASSIST / Define the Prefixes for Argument Name
 
 933    *    When the prefixes is non empty, completion for argument name will begin with
 
 934    *    one of the proposed prefixes.
 
 935    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
 
 936    *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
 939    *  CODEASSIST / Define the Suffixes for Field Name
 
 940    *    When the suffixes is non empty, completion for field name will end with
 
 941    *    one of the proposed suffixes.
 
 942    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
 
 943    *     - possible values:   { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card 
 
 946    *  CODEASSIST / Define the Suffixes for Static Field Name
 
 947    *    When the suffixes is non empty, completion for static field name will end with
 
 948    *    one of the proposed suffixes.
 
 949    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
 
 950    *     - possible values:   { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card 
 
 953    *  CODEASSIST / Define the Suffixes for Local Variable Name
 
 954    *    When the suffixes is non empty, completion for local variable name will end with
 
 955    *    one of the proposed suffixes.
 
 956    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
 
 957    *     - possible values:   { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card 
 
 960    *  CODEASSIST / Define the Suffixes for Argument Name
 
 961    *    When the suffixes is non empty, completion for argument name will end with
 
 962    *    one of the proposed suffixes.
 
 963    *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
 
 964    *     - possible values:   { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card 
 
 968    * @return a mutable table containing the default settings of all known options
 
 969    *   (key type: <code>String</code>; value type: <code>String</code>)
 
 972 //  public static Hashtable getDefaultOptions() {
 
 974 //    Hashtable defaultOptions = new Hashtable(10);
 
 976 //    // see #initializeDefaultPluginPreferences() for changing default settings
 
 977 //    Preferences preferences = getPlugin().getPluginPreferences();
 
 978 //    HashSet optionNames = OptionNames;
 
 980 //    // get preferences set to their default
 
 981 //    String[] defaultPropertyNames = preferences.defaultPropertyNames();
 
 982 //    for (int i = 0; i < defaultPropertyNames.length; i++) {
 
 983 //      String propertyName = defaultPropertyNames[i];
 
 984 //      if (optionNames.contains(propertyName)) {
 
 985 //        defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
 
 988 //    // get preferences not set to their default
 
 989 //    String[] propertyNames = preferences.propertyNames();
 
 990 //    for (int i = 0; i < propertyNames.length; i++) {
 
 991 //      String propertyName = propertyNames[i];
 
 992 //      if (optionNames.contains(propertyName)) {
 
 993 //        defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
 
 996 //    // get encoding through resource plugin
 
 997 //    defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
 
 999 //    return defaultOptions;
 
1002    * Helper method for returning one option value only. Equivalent to <code>(String)JavaCore.getOptions().get(optionName)</code>
 
1003    * Note that it may answer <code>null</code> if this option does not exist.
 
1005    * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
 
1008    * @param optionName the name of an option
 
1009    * @return the String value of a given option
 
1010    * @see JavaCore#getDefaultOptions
 
1013 //  public static String getOption(String optionName) {
 
1015 //    if (CORE_ENCODING.equals(optionName)) {
 
1016 //      return ResourcesPlugin.getEncoding();
 
1018 //    if (OptionNames.contains(optionName)) {
 
1019 //      Preferences preferences = getPlugin().getPluginPreferences();
 
1020 //      return preferences.getString(optionName).trim();
 
1026    * Returns the table of the current options. Initially, all options have their default values,
 
1027    * and this method returns a table that includes all known options.
 
1029    * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
 
1032    * @return table of current settings of all options 
 
1033    *   (key type: <code>String</code>; value type: <code>String</code>)
 
1034    * @see JavaCore#getDefaultOptions
 
1036 //  public static Hashtable getOptions() {
 
1038 //    Hashtable options = new Hashtable(10);
 
1040 //    // see #initializeDefaultPluginPreferences() for changing default settings
 
1041 //    Plugin plugin = getPlugin();
 
1042 //    if (plugin != null) {
 
1043 //      Preferences preferences = getPlugin().getPluginPreferences();
 
1044 //      HashSet optionNames = OptionNames;
 
1046 //      // get preferences set to their default
 
1047 //      String[] defaultPropertyNames = preferences.defaultPropertyNames();
 
1048 //      for (int i = 0; i < defaultPropertyNames.length; i++) {
 
1049 //        String propertyName = defaultPropertyNames[i];
 
1050 //        if (optionNames.contains(propertyName)) {
 
1051 //          options.put(propertyName, preferences.getDefaultString(propertyName));
 
1054 //      // get preferences not set to their default
 
1055 //      String[] propertyNames = preferences.propertyNames();
 
1056 //      for (int i = 0; i < propertyNames.length; i++) {
 
1057 //        String propertyName = propertyNames[i];
 
1058 //        if (optionNames.contains(propertyName)) {
 
1059 //          options.put(propertyName, preferences.getString(propertyName).trim());
 
1062 //      // get encoding through resource plugin
 
1063 //      options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
 
1068    * Sets the current table of options. All and only the options explicitly included in the given table 
 
1069    * are remembered; all previous option settings are forgotten, including ones not explicitly
 
1072    * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
 
1075    * @param newOptions the new options (key type: <code>String</code>; value type: <code>String</code>),
 
1076    *   or <code>null</code> to reset all options to their default values
 
1077    * @see JavaCore#getDefaultOptions
 
1079 //  public static void setOptions(Hashtable newOptions) {
 
1081 //    // see #initializeDefaultPluginPreferences() for changing default settings
 
1082 //    Preferences preferences = getPlugin().getPluginPreferences();
 
1084 //    if (newOptions == null) {
 
1085 //      newOptions = getDefaultOptions();
 
1087 //    Enumeration keys = newOptions.keys();
 
1088 //    while (keys.hasMoreElements()) {
 
1089 //      String key = (String) keys.nextElement();
 
1090 //      if (!OptionNames.contains(key))
 
1091 //        continue; // unrecognized option
 
1092 //      if (key.equals(CORE_ENCODING))
 
1093 //        continue; // skipped, contributed by resource prefs
 
1094 //      String value = (String) newOptions.get(key);
 
1095 //      preferences.setValue(key, value);
 
1098 //    // persist options
 
1099 //    getPlugin().savePluginPreferences();
 
1101   public static IProject[] getPHPProjects() {
 
1102     List phpProjectsList = new ArrayList();
 
1103     IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace().getRoot().getProjects();
 
1105     for (int i = 0; i < workspaceProjects.length; i++) {
 
1106       IProject iProject = workspaceProjects[i];
 
1107       if (isPHPProject(iProject))
 
1108         phpProjectsList.add(iProject);
 
1111     IProject[] phpProjects = new IProject[phpProjectsList.size()];
 
1112     return (IProject[]) phpProjectsList.toArray(phpProjects);
 
1115 //  public static PHPProject getPHPProject(String name) {
 
1116 //    IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(name);
 
1117 //    if (isPHPProject(aProject)) {
 
1118 //      PHPProject thePHPProject = new PHPProject();
 
1119 //      thePHPProject.setProject(aProject);
 
1120 //      return thePHPProject;
 
1125   public static boolean isPHPProject(IProject aProject) {
 
1127       return aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID);
 
1128     } catch (CoreException e) {
 
1134 //  public static PHPFile create(IFile aFile) {
 
1135 //    if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension()))
 
1136 //      return new PHPFile(aFile);
 
1137 //    if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension()))
 
1138 //      return new PHPFile(aFile);
 
1139 //    if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension()))
 
1140 //      return new PHPFile(aFile);
 
1141 //    if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension()))
 
1142 //      return new PHPFile(aFile);
 
1143 //    if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension()))
 
1144 //      return new PHPFile(aFile);
 
1145 //    if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension()))
 
1146 //      return new PHPFile(aFile);
 
1151 //  public static PHPProject create(IProject aProject) {
 
1154 //      if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
 
1155 //        PHPProject project = new PHPProject();
 
1156 //        project.setProject(aProject);
 
1159 //    } catch (CoreException e) {
 
1160 //      System.err.println("Exception occurred in PHPCore#create(IProject): " + e.toString());
 
1166   public static void addPHPNature(IProject project, IProgressMonitor monitor) throws CoreException {
 
1167     if (!project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
 
1168       IProjectDescription description = project.getDescription();
 
1169       String[] prevNatures = description.getNatureIds();
 
1170       String[] newNatures = new String[prevNatures.length + 1];
 
1171       System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
 
1172       newNatures[prevNatures.length] = PHPeclipsePlugin.PHP_NATURE_ID;
 
1173       description.setNatureIds(newNatures);
 
1174       project.setDescription(description, monitor);
 
1179    * Returns the single instance of the PHP core plug-in runtime class.
 
1181    * @return the single instance of the PHP core plug-in runtime class
 
1183   public static Plugin getPlugin() {
 
1184     return PHPeclipsePlugin.getDefault();
 
1188      * Initializes the default preferences settings for this plug-in.
 
1192          * Runs the given action as an atomic Java model operation.
 
1194          * After running a method that modifies Java elements,
 
1195          * registered listeners receive after-the-fact notification of
 
1196          * what just transpired, in the form of a element changed event.
 
1197          * This method allows clients to call a number of
 
1198          * methods that modify java elements and only have element
 
1199          * changed event notifications reported at the end of the entire
 
1203          * If this method is called outside the dynamic scope of another such
 
1204          * call, this method runs the action and then reports a single
 
1205          * element changed event describing the net effect of all changes
 
1206          * done to java elements by the action.
 
1209          * If this method is called in the dynamic scope of another such
 
1210          * call, this method simply runs the action.
 
1213          * @param action the action to perform
 
1214          * @param monitor a progress monitor, or <code>null</code> if progress
 
1215          *    reporting and cancellation are not desired
 
1216          * @exception CoreException if the operation failed.
 
1219   public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException {
 
1220     IWorkspace workspace = ResourcesPlugin.getWorkspace();
 
1221     if (workspace.isTreeLocked()) {
 
1222       new BatchOperation(action).run(monitor);
 
1224       // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode
 
1225       workspace.run(new BatchOperation(action), monitor);
 
1230  * Adds the given listener for changes to Java elements.
 
1231  * Has no effect if an identical listener is already registered.
 
1233  * This listener will only be notified during the POST_CHANGE resource change notification
 
1234  * and any reconcile operation (POST_RECONCILE).
 
1235  * For finer control of the notification, use <code>addElementChangedListener(IElementChangedListener,int)</code>,
 
1236  * which allows to specify a different eventMask.
 
1238  * @see ElementChangedEvent
 
1239  * @param listener the listener
 
1241 public static void addElementChangedListener(IElementChangedListener listener) {
 
1242         addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE);
 
1246  * Adds the given listener for changes to Java elements.
 
1247  * Has no effect if an identical listener is already registered.
 
1248  * After completion of this method, the given listener will be registered for exactly
 
1249  * the specified events.  If they were previously registered for other events, they
 
1250  * will be deregistered.  
 
1252  * Once registered, a listener starts receiving notification of changes to
 
1253  * java elements in the model. The listener continues to receive 
 
1254  * notifications until it is replaced or removed. 
 
1257  * Listeners can listen for several types of event as defined in <code>ElementChangeEvent</code>.
 
1258  * Clients are free to register for any number of event types however if they register
 
1259  * for more than one, it is their responsibility to ensure they correctly handle the
 
1260  * case where the same java element change shows up in multiple notifications.  
 
1261  * Clients are guaranteed to receive only the events for which they are registered.
 
1264  * @param listener the listener
 
1265  * @param eventMask the bit-wise OR of all event types of interest to the listener
 
1266  * @see IElementChangedListener
 
1267  * @see ElementChangedEvent
 
1268  * @see #removeElementChangedListener(IElementChangedListener)
 
1271 public static void addElementChangedListener(IElementChangedListener listener, int eventMask) {
 
1272         JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask);
 
1276  * Configures the given marker attribute map for the given Java element.
 
1277  * Used for markers, which denote a Java element rather than a resource.
 
1279  * @param attributes the mutable marker attribute map (key type: <code>String</code>,
 
1280  *   value type: <code>String</code>)
 
1281  * @param element the Java element for which the marker needs to be configured
 
1283 public static void addJavaElementMarkerAttributes(
 
1285         IJavaElement element) {
 
1286 //      if (element instanceof IMember)
 
1287 //              element = ((IMember) element).getClassFile();
 
1288         if (attributes != null && element != null)
 
1289                 attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier());
 
1293  * Configures the given marker for the given Java element.
 
1294  * Used for markers, which denote a Java element rather than a resource.
 
1296  * @param marker the marker to be configured
 
1297  * @param element the Java element for which the marker needs to be configured
 
1298  * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails
 
1300 public void configureJavaElementMarker(IMarker marker, IJavaElement element)
 
1301         throws CoreException {
 
1302 //      if (element instanceof IMember)
 
1303 //              element = ((IMember) element).getClassFile();
 
1304         if (marker != null && element != null)
 
1305                 marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier());
 
1309  * Returns the Java model element corresponding to the given handle identifier
 
1310  * generated by <code>IJavaElement.getHandleIdentifier()</code>, or
 
1311  * <code>null</code> if unable to create the associated element.
 
1313 public static IJavaElement create(String handleIdentifier) {
 
1314         if (handleIdentifier == null) {
 
1318                 return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier);
 
1319         } catch (JavaModelException e) {
 
1324  * Returns the Java element corresponding to the given file, or
 
1325  * <code>null</code> if unable to associate the given file
 
1326  * with a Java element.
 
1328  * <p>The file must be one of:<ul>
 
1329  *      <li>a <code>.java</code> file - the element returned is the corresponding <code>ICompilationUnit</code></li>
 
1330  *      <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li>
 
1331  *      <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li>
 
1334  * Creating a Java element has the side effect of creating and opening all of the
 
1335  * element's parents if they are not yet open.
 
1337  * @param the given file
 
1338  * @return the Java element corresponding to the given file, or
 
1339  * <code>null</code> if unable to associate the given file
 
1340  * with a Java element
 
1342 public static IJavaElement create(IFile file) {
 
1343         return JavaModelManager.create(file, null);
 
1346  * Returns the package fragment or package fragment root corresponding to the given folder, or
 
1347  * <code>null</code> if unable to associate the given folder with a Java element.
 
1349  * Note that a package fragment root is returned rather than a default package.
 
1351  * Creating a Java element has the side effect of creating and opening all of the
 
1352  * element's parents if they are not yet open.
 
1354  * @param the given folder
 
1355  * @return the package fragment or package fragment root corresponding to the given folder, or
 
1356  * <code>null</code> if unable to associate the given folder with a Java element
 
1358 public static IJavaElement create(IFolder folder) {
 
1359         return JavaModelManager.create(folder, null);
 
1362  * Returns the Java project corresponding to the given project.
 
1364  * Creating a Java Project has the side effect of creating and opening all of the
 
1365  * project's parents if they are not yet open.
 
1367  * Note that no check is done at this time on the existence or the java nature of this project.
 
1369  * @param project the given project
 
1370  * @return the Java project corresponding to the given project, null if the given project is null
 
1372 public static IJavaProject create(IProject project) {
 
1373         if (project == null) {
 
1376         JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel();
 
1377         return javaModel.getJavaProject(project);
 
1380  * Returns the Java element corresponding to the given resource, or
 
1381  * <code>null</code> if unable to associate the given resource
 
1382  * with a Java element.
 
1384  * The resource must be one of:<ul>
 
1385  *      <li>a project - the element returned is the corresponding <code>IJavaProject</code></li>
 
1386  *      <li>a <code>.java</code> file - the element returned is the corresponding <code>ICompilationUnit</code></li>
 
1387  *      <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li>
 
1388  *      <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li>
 
1389  *  <li>a folder - the element returned is the corresponding <code>IPackageFragmentRoot</code>
 
1390  *      or <code>IPackageFragment</code></li>
 
1391  *  <li>the workspace root resource - the element returned is the <code>IJavaModel</code></li>
 
1394  * Creating a Java element has the side effect of creating and opening all of the
 
1395  * element's parents if they are not yet open.
 
1397  * @param resource the given resource
 
1398  * @return the Java element corresponding to the given resource, or
 
1399  * <code>null</code> if unable to associate the given resource
 
1400  * with a Java element
 
1402 public static IJavaElement create(IResource resource) {
 
1403         return JavaModelManager.create(resource, null);
 
1406  * Returns the Java model.
 
1408  * @param root the given root
 
1409  * @return the Java model, or <code>null</code> if the root is null
 
1411 public static IJavaModel create(IWorkspaceRoot root) {
 
1415         return JavaModelManager.getJavaModelManager().getJavaModel();
 
1418  * Creates and returns a class file element for
 
1419  * the given <code>.class</code> file. Returns <code>null</code> if unable
 
1420  * to recognize the class file.
 
1422  * @param file the given <code>.class</code> file
 
1423  * @return a class file element for the given <code>.class</code> file, or <code>null</code> if unable
 
1424  * to recognize the class file
 
1426 //public static IClassFile createClassFileFrom(IFile file) {
 
1427 //      return JavaModelManager.createClassFileFrom(file, null);
 
1430  * Creates and returns a compilation unit element for
 
1431  * the given <code>.java</code> file. Returns <code>null</code> if unable
 
1432  * to recognize the compilation unit.
 
1434  * @param file the given <code>.java</code> file
 
1435  * @return a compilation unit element for the given <code>.java</code> file, or <code>null</code> if unable
 
1436  * to recognize the compilation unit
 
1438 public static ICompilationUnit createCompilationUnitFrom(IFile file) {
 
1439         return JavaModelManager.createCompilationUnitFrom(file, null);
 
1442  * Creates and returns a handle for the given JAR file.
 
1443  * The Java model associated with the JAR's project may be
 
1444  * created as a side effect. 
 
1446  * @param file the given JAR file
 
1447  * @return a handle for the given JAR file, or <code>null</code> if unable to create a JAR package fragment root.
 
1448  * (for example, if the JAR file represents a non-Java resource)
 
1450 //public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) {
 
1451 //      return JavaModelManager.createJarPackageFragmentRootFrom(file, null);
 
1455  * Answers the project specific value for a given classpath container.
 
1456  * In case this container path could not be resolved, then will answer <code>null</code>.
 
1457  * Both the container path and the project context are supposed to be non-null.
 
1459  * The containerPath is a formed by a first ID segment followed with extra segments, which can be 
 
1460  * used as additional hints for resolution. If no container was ever recorded for this container path 
 
1461  * onto this project (using <code>setClasspathContainer</code>, then a 
 
1462  * <code>ClasspathContainerInitializer</code> will be activated if any was registered for this container 
 
1463  * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
 
1465  * There is no assumption that the returned container must answer the exact same containerPath
 
1466  * when requested <code>IClasspathContainer#getPath</code>. 
 
1467  * Indeed, the containerPath is just an indication for resolving it to an actual container object.
 
1469  * Classpath container values are persisted locally to the workspace, but 
 
1470  * are not preserved from a session to another. It is thus highly recommended to register a 
 
1471  * <code>ClasspathContainerInitializer</code> for each referenced container 
 
1472  * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
 
1474  * @param containerPath the name of the container, which needs to be resolved
 
1475  * @param project a specific project in which the container is being resolved
 
1476  * @return the corresponding classpath container or <code>null</code> if unable to find one.
 
1478  * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container
 
1479  *   contains illegal entries (contains CPE_CONTAINER entries or null entries).  
 
1481  * @see ClasspathContainerInitializer
 
1482  * @see IClasspathContainer
 
1483  * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
 
1486 //public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException {
 
1488 //      IClasspathContainer container = JavaModelManager.containerGet(project, containerPath);
 
1489 //      if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle
 
1491 //      if (container == null){
 
1492 //              final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
 
1493 //              if (initializer != null){
 
1494 //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
1495 //                              System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
 
1496 //                              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$
 
1498 //                      JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles
 
1499 //                      boolean ok = false;
 
1501 //                              // wrap initializer call with Safe runnable in case initializer would be causing some grief
 
1502 //                              Platform.run(new ISafeRunnable() {
 
1503 //                                      public void handleException(Throwable exception) {
 
1504 //                                              Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$
 
1506 //                                      public void run() throws Exception {
 
1507 //                                              initializer.initialize(containerPath, project);
 
1511 //                              // retrieve value (if initialization was successful)
 
1512 //                              container = JavaModelManager.containerGet(project, containerPath);
 
1513 //                              if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle
 
1516 //                              if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache
 
1518 //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
1519 //                              System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$
 
1520 //                              if (container != null){
 
1521 //                                      System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$
 
1522 //                                      IClasspathEntry[] entries = container.getClasspathEntries();
 
1523 //                                      if (entries != null){
 
1524 //                                              for (int i = 0; i < entries.length; i++){
 
1525 //                                                      if (i > 0) System.out.println(", ");//$NON-NLS-1$
 
1526 //                                                      System.out.println(entries[i]);
 
1529 //                                      System.out.println("}");//$NON-NLS-1$
 
1531 //                                      System.out.println("{unbound}");//$NON-NLS-1$
 
1535 //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
1536 //                              System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$
 
1540 //      return container;                       
 
1544  * Helper method finding the classpath container initializer registered for a given classpath container ID 
 
1545  * or <code>null</code> if none was found while iterating over the contributions to extension point to
 
1546  * the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
 
1548  * A containerID is the first segment of any container path, used to identify the registered container initializer.
 
1550  * @param String - a containerID identifying a registered initializer
 
1551  * @return ClasspathContainerInitializer - the registered classpath container initializer or <code>null</code> if 
 
1555 //public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){
 
1557 //      Plugin jdtCorePlugin = JavaCore.getPlugin();
 
1558 //      if (jdtCorePlugin == null) return null;
 
1560 //      IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
 
1561 //      if (extension != null) {
 
1562 //              IExtension[] extensions =  extension.getExtensions();
 
1563 //              for(int i = 0; i < extensions.length; i++){
 
1564 //                      IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
 
1565 //                      for(int j = 0; j < configElements.length; j++){
 
1566 //                              String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$
 
1567 //                              if (initializerID != null && initializerID.equals(containerID)){
 
1568 //                                      if (JavaModelManager.CP_RESOLVE_VERBOSE) {
 
1569 //                                              System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
 
1572 //                                              Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
 
1573 //                                              if (execExt instanceof ClasspathContainerInitializer){
 
1574 //                                                      return (ClasspathContainerInitializer)execExt;
 
1576 //                                      } catch(CoreException e) {
 
1586  * Returns the path held in the given classpath variable.
 
1587  * Returns <node>null</code> if unable to bind.
 
1589  * Classpath variable values are persisted locally to the workspace, and 
 
1590  * are preserved from session to session.
 
1592  * Note that classpath variables can be contributed registered initializers for,
 
1593  * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
 
1594  * If an initializer is registered for a variable, its persisted value will be ignored:
 
1595  * its initializer will thus get the opportunity to rebind the variable differently on
 
1598  * @param variableName the name of the classpath variable
 
1599  * @return the path, or <code>null</code> if none 
 
1600  * @see #setClasspathVariable
 
1602 public static IPath getClasspathVariable(final String variableName) {
 
1604         IPath variablePath = JavaModelManager.variableGet(variableName);
 
1605         if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle
 
1607         if (variablePath != null) {
 
1608                 return variablePath;
 
1611         // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused
 
1612 //      final ClasspathVariableInitializer initializer = PHPCore.getClasspathVariableInitializer(variableName);
 
1613 //      if (initializer != null){ 
 
1614 //              if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
1615 //                      System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$
 
1616 //                      new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$
 
1618 //              JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles
 
1619 //              boolean ok = false;
 
1621 //                      // wrap initializer call with Safe runnable in case initializer would be causing some grief
 
1622 //                      Platform.run(new ISafeRunnable() {
 
1623 //                              public void handleException(Throwable exception) {
 
1624 //                                      Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$
 
1626 //                              public void run() throws Exception {
 
1627 //                                      initializer.initialize(variableName);
 
1630 //                      variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect
 
1631 //                      if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call)
 
1632 //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
1633 //                              System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$
 
1637 //                      if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache
 
1640 //              if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
1641 //                      System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$
 
1644         return variablePath;
 
1648  * Helper method finding the classpath variable initializer registered for a given classpath variable name 
 
1649  * or <code>null</code> if none was found while iterating over the contributions to extension point to
 
1650  * the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
 
1652  * @param the given variable
 
1653  * @return ClasspathVariableInitializer - the registered classpath variable initializer or <code>null</code> if 
 
1657 public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){
 
1659         Plugin jdtCorePlugin = JavaCore.getPlugin();
 
1660         if (jdtCorePlugin == null) return null;
 
1662 //      IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
 
1663 //      if (extension != null) {
 
1664 //              IExtension[] extensions =  extension.getExtensions();
 
1665 //              for(int i = 0; i < extensions.length; i++){
 
1666 //                      IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
 
1667 //                      for(int j = 0; j < configElements.length; j++){
 
1669 //                                      String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$
 
1670 //                                      if (variable.equals(varAttribute)) {
 
1671 //                                              if (JavaModelManager.CP_RESOLVE_VERBOSE) {
 
1672 //                                                      System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
 
1674 //                                              Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
 
1675 //                                              if (execExt instanceof ClasspathVariableInitializer){
 
1676 //                                                      return (ClasspathVariableInitializer)execExt;
 
1679 //                              } catch(CoreException e){
 
1688  * Returns the names of all known classpath variables.
 
1690  * Classpath variable values are persisted locally to the workspace, and 
 
1691  * are preserved from session to session.
 
1694  * @return the list of classpath variable names
 
1695  * @see #setClasspathVariable
 
1697 //public static String[] getClasspathVariableNames() {
 
1698 //      return JavaModelManager.variableNames();
 
1702  * Returns a table of all known configurable options with their default values.
 
1703  * These options allow to configure the behaviour of the underlying components.
 
1704  * The client may safely use the result as a template that they can modify and
 
1705  * then pass to <code>setOptions</code>.
 
1707  * Helper constants have been defined on JavaCore for each of the option ID and 
 
1708  * their possible constant values.
 
1710  * Note: more options might be added in further releases.
 
1712  * RECOGNIZED OPTIONS:
 
1713  * COMPILER / Generating Local Variable Debug Attribute
 
1714  *    When generated, this attribute will enable local variable names 
 
1715  *    to be displayed in debugger, only in place where variables are 
 
1716  *    definitely assigned (.class file is then bigger)
 
1717  *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
 
1718  *     - possible values:   { "generate", "do not generate" }
 
1719  *     - default:           "generate"
 
1721  * COMPILER / Generating Line Number Debug Attribute 
 
1722  *    When generated, this attribute will enable source code highlighting in debugger 
 
1723  *    (.class file is then bigger).
 
1724  *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
 
1725  *     - possible values:   { "generate", "do not generate" }
 
1726  *     - default:           "generate"
 
1728  * COMPILER / Generating Source Debug Attribute 
 
1729  *    When generated, this attribute will enable the debugger to present the 
 
1730  *    corresponding source code.
 
1731  *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
 
1732  *     - possible values:   { "generate", "do not generate" }
 
1733  *     - default:           "generate"
 
1735  * COMPILER / Preserving Unused Local Variables
 
1736  *    Unless requested to preserve unused local variables (that is, never read), the 
 
1737  *    compiler will optimize them out, potentially altering debugging
 
1738  *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
 
1739  *     - possible values:   { "preserve", "optimize out" }
 
1740  *     - default:           "preserve"
 
1742  * COMPILER / Defining Target Java Platform
 
1743  *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
 
1744  *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
 
1745  *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
 
1746  *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
 
1749  * COMPILER / Reporting Unreachable Code
 
1750  *    Unreachable code can optionally be reported as an error, warning or simply 
 
1751  *    ignored. The bytecode generation will always optimized it out.
 
1752  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
 
1753  *     - possible values:   { "error", "warning", "ignore" }
 
1754  *     - default:           "error"
 
1756  * COMPILER / Reporting Invalid Import
 
1757  *    An import statement that cannot be resolved might optionally be reported 
 
1758  *    as an error, as a warning or ignored.
 
1759  *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
 
1760  *     - possible values:   { "error", "warning", "ignore" }
 
1761  *     - default:           "error"
 
1763  * COMPILER / Reporting Attempt to Override Package-Default Method
 
1764  *    A package default method is not visible in a different package, and thus 
 
1765  *    cannot be overridden. When enabling this option, the compiler will signal 
 
1766  *    such scenarii either as an error or a warning.
 
1767  *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
 
1768  *     - possible values:   { "error", "warning", "ignore" }
 
1769  *     - default:           "warning"
 
1771  * COMPILER / Reporting Method With Constructor Name
 
1772  *    Naming a method with a constructor name is generally considered poor 
 
1773  *    style programming. When enabling this option, the compiler will signal such 
 
1774  *    scenarii either as an error or a warning.
 
1775  *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
 
1776  *     - possible values:   { "error", "warning", "ignore" }
 
1777  *     - default:           "warning"
 
1779  * COMPILER / Reporting Deprecation
 
1780  *    When enabled, the compiler will signal use of deprecated API either as an 
 
1781  *    error or a warning.
 
1782  *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
 
1783  *     - possible values:   { "error", "warning", "ignore" }
 
1784  *     - default:           "warning"
 
1786  * COMPILER / Reporting Deprecation Inside Deprecated Code
 
1787  *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
 
1788  *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
 
1789  *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
 
1790  *     - possible values:   { "enabled", "disabled" }
 
1791  *     - default:           "disabled"
 
1793  * COMPILER / Reporting Hidden Catch Block
 
1794  *    Locally to a try statement, some catch blocks may hide others . For example,
 
1795  *      try {  throw new java.io.CharConversionException();
 
1796  *      } catch (java.io.CharConversionException e) {
 
1797  *      } catch (java.io.IOException e) {}. 
 
1798  *    When enabling this option, the compiler will issue an error or a warning for hidden 
 
1799  *    catch blocks corresponding to checked exceptions
 
1800  *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
 
1801  *     - possible values:   { "error", "warning", "ignore" }
 
1802  *     - default:           "warning"
 
1804  * COMPILER / Reporting Unused Local
 
1805  *    When enabled, the compiler will issue an error or a warning for unused local 
 
1806  *    variables (that is, variables never read from)
 
1807  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
 
1808  *     - possible values:   { "error", "warning", "ignore" }
 
1809  *     - default:           "ignore"
 
1811  * COMPILER / Reporting Unused Parameter
 
1812  *    When enabled, the compiler will issue an error or a warning for unused method 
 
1813  *    parameters (that is, parameters never read from)
 
1814  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
 
1815  *     - possible values:   { "error", "warning", "ignore" }
 
1816  *     - default:           "ignore"
 
1818  * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
 
1819  *    When enabled, the compiler will signal unused parameters in abstract method implementations.
 
1820  *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
 
1821  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
 
1822  *     - possible values:   { "enabled", "disabled" }
 
1823  *     - default:           "disabled"
 
1825  * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
 
1826  *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
 
1827  *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
 
1828  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
 
1829  *     - possible values:   { "enabled", "disabled" }
 
1830  *     - default:           "disabled"
 
1832  * COMPILER / Reporting Unused Import
 
1833  *    When enabled, the compiler will issue an error or a warning for unused import 
 
1835  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
 
1836  *     - possible values:   { "error", "warning", "ignore" }
 
1837  *     - default:           "warning"
 
1839  * COMPILER / Reporting Unused Private Members
 
1840  *    When enabled, the compiler will issue an error or a warning whenever a private 
 
1841  *    method or field is declared but never used within the same unit.
 
1842  *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
 
1843  *     - possible values:   { "error", "warning", "ignore" }
 
1844  *     - default:           "ignore"
 
1846  * COMPILER / Reporting Synthetic Access Emulation
 
1847  *    When enabled, the compiler will issue an error or a warning whenever it emulates 
 
1848  *    access to a non-accessible member of an enclosing type. Such access can have
 
1849  *    performance implications.
 
1850  *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
 
1851  *     - possible values:   { "error", "warning", "ignore" }
 
1852  *     - default:           "ignore"
 
1854  * COMPILER / Reporting Non-Externalized String Literal
 
1855  *    When enabled, the compiler will issue an error or a warning for non externalized 
 
1856  *    String literal (that is, not tagged with //$NON-NLS-<n>$). 
 
1857  *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
 
1858  *     - possible values:   { "error", "warning", "ignore" }
 
1859  *     - default:           "ignore"
 
1861  * COMPILER / Reporting Usage of 'assert' Identifier
 
1862  *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
 
1863  *    used as an identifier (reserved keyword in 1.4)
 
1864  *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
 
1865  *     - possible values:   { "error", "warning", "ignore" }
 
1866  *     - default:           "ignore"
 
1868  * COMPILER / Reporting Non-Static Reference to a Static Member
 
1869  *    When enabled, the compiler will issue an error or a warning whenever a static field
 
1870  *    or method is accessed with an expression receiver. A reference to a static member should
 
1871  *    be qualified with a type name.
 
1872  *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
 
1873  *     - possible values:   { "error", "warning", "ignore" }
 
1874  *     - default:           "warning"
 
1876  * COMPILER / Reporting Assignment with no Effect
 
1877  *    When enabled, the compiler will issue an error or a warning whenever an assignment
 
1878  *    has no effect (e.g 'x = x').
 
1879  *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
 
1880  *     - possible values:   { "error", "warning", "ignore" }
 
1881  *     - default:           "warning"
 
1883  * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
 
1884  *    When enabled, the compiler will issue an error or a warning whenever an interface
 
1885  *    defines a method incompatible with a non-inherited Object method. Until this conflict
 
1886  *    is resolved, such an interface cannot be implemented, For example, 
 
1890  *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
 
1891  *     - possible values:   { "error", "warning", "ignore" }
 
1892  *     - default:           "warning"
 
1894  * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
 
1895  *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
 
1896  *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
 
1897  *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
 
1898  *     - possible values:   { "error", "warning", "ignore" }
 
1899  *     - default:           "warning"
 
1901  * COMPILER / Setting Source Compatibility Mode
 
1902  *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
 
1903  *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
 
1904  *   level should be set to "1.4" and the compliance mode should be "1.4".
 
1905  *     - option id:         "org.eclipse.jdt.core.compiler.source"
 
1906  *     - possible values:   { "1.3", "1.4" }
 
1909  * COMPILER / Setting Compliance Level
 
1910  *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
 
1911  *    should not go beyond "1.3" level.
 
1912  *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
 
1913  *     - possible values:   { "1.3", "1.4" }
 
1916  * COMPILER / Maximum number of problems reported per compilation unit
 
1917  *    Specify the maximum number of problems reported on each compilation unit.
 
1918  *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
 
1919  *     - possible values:       "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
 
1922  * COMPILER / Define the Automatic Task Tags
 
1923  *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
 
1924  *    one of the corresponding tag inside any comment in Java source code.
 
1925  *    Generated task messages will include the tag, and range until the next line separator or comment ending.
 
1926  *    Note that tasks messages are trimmed.
 
1927  *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
 
1928  *     - possible values:   { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces 
 
1931  * COMPILER / Define the Automatic Task Priorities
 
1932  *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
 
1933  *    of the task markers issued by the compiler.
 
1934  *    If the default is specified, the priority of each task marker is "NORMAL".
 
1935  *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
 
1936  *     - possible values:   { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
 
1939  * BUILDER / Specifying Filters for Resource Copying Control
 
1940  *    Allow to specify some filters to control the resource copy process.
 
1941  *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
 
1942  *     - possible values:   { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
 
1943  *       or the name of a folder which ends with '/'
 
1946  * BUILDER / Abort if Invalid Classpath
 
1947  *    Allow to toggle the builder to abort if the classpath is invalid
 
1948  *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
 
1949  *     - possible values:   { "abort", "ignore" }
 
1950  *     - default:           "abort"
 
1952  * BUILDER / Cleaning Output Folder(s)
 
1953  *    Indicate whether the JavaBuilder is allowed to clean the output folders
 
1954  *    when performing full build operations.
 
1955  *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
 
1956  *     - possible values:   { "clean", "ignore" }
 
1957  *     - default:           "clean"
 
1959  * BUILDER / Reporting Duplicate Resources
 
1960  *    Indicate the severity of the problem reported when more than one occurrence
 
1961  *    of a resource is to be copied into the output location.
 
1962  *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
 
1963  *     - possible values:   { "error", "warning" }
 
1964  *     - default:           "warning"
 
1966  * JAVACORE / Computing Project Build Order
 
1967  *    Indicate whether JavaCore should enforce the project build order to be based on
 
1968  *    the classpath prerequisite chain. When requesting to compute, this takes over
 
1969  *    the platform default order (based on project references).
 
1970  *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
 
1971  *     - possible values:   { "compute", "ignore" }
 
1972  *     - default:           "ignore"     
 
1974  * JAVACORE / Specify Default Source Encoding Format
 
1975  *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
 
1976  *    to 'ResourcesPlugin.getEncoding()'.
 
1977  *     - option id:         "org.eclipse.jdt.core.encoding"
 
1978  *     - possible values:   { any of the supported encoding name}.
 
1979  *     - default:           <platform default>
 
1981  * JAVACORE / Reporting Incomplete Classpath
 
1982  *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
 
1983  *    is not legite or is not visible (for example, a referenced project is closed).
 
1984  *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
 
1985  *     - possible values:   { "error", "warning"}
 
1986  *     - default:           "error"
 
1988  * JAVACORE / Reporting Classpath Cycle
 
1989  *    Indicate the severity of the problem reported when a project is involved in a cycle.
 
1990  *     - option id:         "org.eclipse.jdt.core.circularClasspath"
 
1991  *     - possible values:   { "error", "warning" }
 
1992  *     - default:           "error"
 
1994  * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
 
1995  *    When disabled, no entry on a project classpath can be associated with
 
1996  *    an exclusion pattern.
 
1997  *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
 
1998  *     - possible values:   { "enabled", "disabled" }
 
1999  *     - default:           "enabled"
 
2001  * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
 
2002  *    When disabled, no entry on a project classpath can be associated with
 
2003  *    a specific output location, preventing thus usage of multiple output locations.
 
2004  *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
 
2005  *     - possible values:   { "enabled", "disabled" }
 
2006  *     - default:           "enabled"
 
2008  *      FORMATTER / Inserting New Line Before Opening Brace
 
2009  *    When Insert, a new line is inserted before an opening brace, otherwise nothing
 
2011  *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
 
2012  *     - possible values:   { "insert", "do not insert" }
 
2013  *     - default:           "do not insert"
 
2015  *      FORMATTER / Inserting New Line Inside Control Statement
 
2016  *    When Insert, a new line is inserted between } and following else, catch, finally
 
2017  *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
 
2018  *     - possible values:   { "insert", "do not insert" }
 
2019  *     - default:           "do not insert"
 
2021  *      FORMATTER / Clearing Blank Lines
 
2022  *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
 
2023  *    and all others removed.
 
2024  *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
 
2025  *     - possible values:   { "clear all", "preserve one" }
 
2026  *     - default:           "preserve one"
 
2028  *      FORMATTER / Inserting New Line Between Else/If 
 
2029  *    When Insert, a blank line is inserted between an else and an if when they are 
 
2030  *    contiguous. When choosing to not insert, else-if will be kept on the same
 
2031  *    line when possible.
 
2032  *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
 
2033  *     - possible values:   { "insert", "do not insert" }
 
2034  *     - default:           "do not insert"
 
2036  *      FORMATTER / Inserting New Line In Empty Block
 
2037  *    When insert, a line break is inserted between contiguous { and }, if } is not followed
 
2039  *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
 
2040  *     - possible values:   { "insert", "do not insert" }
 
2041  *     - default:           "insert"
 
2043  *      FORMATTER / Splitting Lines Exceeding Length
 
2044  *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
 
2045  *    disable line splitting
 
2046  *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
 
2047  *     - possible values:       "<n>", where n is zero or a positive integer
 
2050  *      FORMATTER / Compacting Assignment
 
2051  *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
 
2052  *    is inserted before the assignment operator
 
2053  *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
 
2054  *     - possible values:   { "compact", "normal" }
 
2055  *     - default:           "normal"
 
2057  *      FORMATTER / Defining Indentation Character
 
2058  *    Either choose to indent with tab characters or spaces
 
2059  *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
 
2060  *     - possible values:   { "tab", "space" }
 
2063  *      FORMATTER / Defining Space Indentation Length
 
2064  *    When using spaces, set the amount of space characters to use for each 
 
2066  *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
 
2067  *     - possible values:       "<n>", where n is a positive integer
 
2070  *      FORMATTER / Inserting space in cast expression
 
2071  *    When Insert, a space is added between the type and the expression in a cast expression.
 
2072  *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
 
2073  *     - possible values:   { "insert", "do not insert" }
 
2074  *     - default:           "insert"
 
2076  *      CODEASSIST / Activate Visibility Sensitive Completion
 
2077  *    When active, completion doesn't show that you can not see
 
2078  *    (for example, you can not see private methods of a super class).
 
2079  *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
 
2080  *     - possible values:   { "enabled", "disabled" }
 
2081  *     - default:           "disabled"
 
2083  *      CODEASSIST / Automatic Qualification of Implicit Members
 
2084  *    When active, completion automatically qualifies completion on implicit
 
2085  *    field references and message expressions.
 
2086  *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
 
2087  *     - possible values:   { "enabled", "disabled" }
 
2088  *     - default:           "disabled"
 
2090  *  CODEASSIST / Define the Prefixes for Field Name
 
2091  *    When the prefixes is non empty, completion for field name will begin with
 
2092  *    one of the proposed prefixes.
 
2093  *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
 
2094  *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
2097  *  CODEASSIST / Define the Prefixes for Static Field Name
 
2098  *    When the prefixes is non empty, completion for static field name will begin with
 
2099  *    one of the proposed prefixes.
 
2100  *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
 
2101  *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
2104  *  CODEASSIST / Define the Prefixes for Local Variable Name
 
2105  *    When the prefixes is non empty, completion for local variable name will begin with
 
2106  *    one of the proposed prefixes.
 
2107  *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
 
2108  *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
2111  *  CODEASSIST / Define the Prefixes for Argument Name
 
2112  *    When the prefixes is non empty, completion for argument name will begin with
 
2113  *    one of the proposed prefixes.
 
2114  *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
 
2115  *     - possible values:   { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card 
 
2118  *  CODEASSIST / Define the Suffixes for Field Name
 
2119  *    When the suffixes is non empty, completion for field name will end with
 
2120  *    one of the proposed suffixes.
 
2121  *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
 
2122  *     - possible values:   { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card 
 
2125  *  CODEASSIST / Define the Suffixes for Static Field Name
 
2126  *    When the suffixes is non empty, completion for static field name will end with
 
2127  *    one of the proposed suffixes.
 
2128  *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
 
2129  *     - possible values:   { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card 
 
2132  *  CODEASSIST / Define the Suffixes for Local Variable Name
 
2133  *    When the suffixes is non empty, completion for local variable name will end with
 
2134  *    one of the proposed suffixes.
 
2135  *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
 
2136  *     - possible values:   { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card 
 
2139  *  CODEASSIST / Define the Suffixes for Argument Name
 
2140  *    When the suffixes is non empty, completion for argument name will end with
 
2141  *    one of the proposed suffixes.
 
2142  *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
 
2143  *     - possible values:   { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card 
 
2147  * @return a mutable table containing the default settings of all known options
 
2148  *   (key type: <code>String</code>; value type: <code>String</code>)
 
2151 public static Hashtable getDefaultOptions(){
 
2153         Hashtable defaultOptions = new Hashtable(10);
 
2155         // see #initializeDefaultPluginPreferences() for changing default settings
 
2156         Preferences preferences = getPlugin().getPluginPreferences();
 
2157         HashSet optionNames = JavaModelManager.OptionNames;
 
2159         // get preferences set to their default
 
2160         String[] defaultPropertyNames = preferences.defaultPropertyNames();
 
2161         for (int i = 0; i < defaultPropertyNames.length; i++){
 
2162                 String propertyName = defaultPropertyNames[i];
 
2163                 if (optionNames.contains(propertyName)) {
 
2164                         defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
 
2167         // get preferences not set to their default
 
2168         String[] propertyNames = preferences.propertyNames();
 
2169         for (int i = 0; i < propertyNames.length; i++){
 
2170                 String propertyName = propertyNames[i];
 
2171                 if (optionNames.contains(propertyName)) {
 
2172                         defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
 
2175         // get encoding through resource plugin
 
2176         defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); 
 
2178         return defaultOptions;
 
2182  * Returns the single instance of the Java core plug-in runtime class.
 
2183  * Equivalent to <code>(JavaCore) getPlugin()</code>.
 
2185  * @return the single instance of the Java core plug-in runtime class
 
2187 public static PHPeclipsePlugin getJavaCore() {
 
2188         return (PHPeclipsePlugin) getPlugin();
 
2192  * Helper method for returning one option value only. Equivalent to <code>(String)JavaCore.getOptions().get(optionName)</code>
 
2193  * Note that it may answer <code>null</code> if this option does not exist.
 
2195  * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
 
2198  * @param optionName the name of an option
 
2199  * @return the String value of a given option
 
2200  * @see JavaCore#getDefaultOptions
 
2203 public static String getOption(String optionName) {
 
2205         if (CORE_ENCODING.equals(optionName)){
 
2206                 return ResourcesPlugin.getEncoding();
 
2208         if (JavaModelManager.OptionNames.contains(optionName)){
 
2209                 Preferences preferences = getPlugin().getPluginPreferences();
 
2210                 return preferences.getString(optionName).trim();
 
2216  * Returns the table of the current options. Initially, all options have their default values,
 
2217  * and this method returns a table that includes all known options.
 
2219  * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
 
2222  * @return table of current settings of all options 
 
2223  *   (key type: <code>String</code>; value type: <code>String</code>)
 
2224  * @see JavaCore#getDefaultOptions
 
2226 public static Hashtable getOptions() {
 
2228         Hashtable options = new Hashtable(10);
 
2230         // see #initializeDefaultPluginPreferences() for changing default settings
 
2231         Plugin plugin = getPlugin();
 
2232         if (plugin != null) {
 
2233                 Preferences preferences = getPlugin().getPluginPreferences();
 
2234                 HashSet optionNames = JavaModelManager.OptionNames;
 
2236                 // get preferences set to their default
 
2237                 String[] defaultPropertyNames = preferences.defaultPropertyNames();
 
2238                 for (int i = 0; i < defaultPropertyNames.length; i++){
 
2239                         String propertyName = defaultPropertyNames[i];
 
2240                         if (optionNames.contains(propertyName)){
 
2241                                 options.put(propertyName, preferences.getDefaultString(propertyName));
 
2244                 // get preferences not set to their default
 
2245                 String[] propertyNames = preferences.propertyNames();
 
2246                 for (int i = 0; i < propertyNames.length; i++){
 
2247                         String propertyName = propertyNames[i];
 
2248                         if (optionNames.contains(propertyName)){
 
2249                                 options.put(propertyName, preferences.getString(propertyName).trim());
 
2252                 // get encoding through resource plugin
 
2253                 options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
 
2259  * This is a helper method, which returns the resolved classpath entry denoted 
 
2260  * by a given entry (if it is a variable entry). It is obtained by resolving the variable 
 
2261  * reference in the first segment. Returns <node>null</code> if unable to resolve using 
 
2262  * the following algorithm:
 
2264  * <li> if variable segment cannot be resolved, returns <code>null</code></li>
 
2265  * <li> finds a project, JAR or binary folder in the workspace at the resolved path location</li>
 
2266  * <li> if none finds an external JAR file or folder outside the workspace at the resolved path location </li>
 
2267  * <li> if none returns <code>null</code></li>
 
2270  * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry.
 
2272  * NOTE: This helper method does not handle classpath containers, for which should rather be used
 
2273  * <code>JavaCore#getClasspathContainer(IPath, IJavaProject)</code>.
 
2276  * @param entry the given variable entry
 
2277  * @return the resolved library or project classpath entry, or <code>null</code>
 
2278  *   if the given variable entry could not be resolved to a valid classpath entry
 
2280 public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) {
 
2282         if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE)
 
2285         IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
 
2286         IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath());
 
2287         if (resolvedPath == null)
 
2290         Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false);
 
2294         // inside the workspace
 
2295         if (target instanceof IResource) {
 
2296                 IResource resolvedResource = (IResource) target;
 
2297                 if (resolvedResource != null) {
 
2298                         switch (resolvedResource.getType()) {
 
2300                                 case IResource.PROJECT :  
 
2302                                         return JavaCore.newProjectEntry(resolvedPath, entry.isExported());
 
2304                                 case IResource.FILE : 
 
2305 //                                      if (Util.isArchiveFileName(resolvedResource.getName())) {
 
2306 //                                              // internal binary archive
 
2307 //                                              return JavaCore.newLibraryEntry(
 
2309 //                                                              getResolvedVariablePath(entry.getSourceAttachmentPath()),
 
2310 //                                                              getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
 
2311 //                                                              entry.isExported());
 
2315                                 case IResource.FOLDER : 
 
2316                                         // internal binary folder
 
2317 //                                      return JavaCore.newLibraryEntry(
 
2319 //                                                      getResolvedVariablePath(entry.getSourceAttachmentPath()),
 
2320 //                                                      getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
 
2321 //                                                      entry.isExported());
 
2326         // outside the workspace
 
2327         if (target instanceof File) {
 
2328                 File externalFile = (File) target;
 
2329                 if (externalFile.isFile()) {
 
2330                         String fileName = externalFile.getName().toLowerCase();
 
2331 //                      if (fileName.endsWith(".jar"  //$NON-NLS-1$
 
2332 //                              ) || fileName.endsWith(".zip"  //$NON-NLS-1$
 
2333 //                              )) { // external binary archive
 
2334 //                              return JavaCore.newLibraryEntry(
 
2336 //                                              getResolvedVariablePath(entry.getSourceAttachmentPath()),
 
2337 //                                              getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
 
2338 //                                              entry.isExported());
 
2340                 } else { // external binary folder
 
2341                         if (resolvedPath.isAbsolute()){
 
2342 //                              return JavaCore.newLibraryEntry(
 
2344 //                                              getResolvedVariablePath(entry.getSourceAttachmentPath()),
 
2345 //                                              getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
 
2346 //                                              entry.isExported());
 
2355  * Resolve a variable path (helper method).
 
2357  * @param variablePath the given variable path
 
2358  * @return the resolved variable path or <code>null</code> if none
 
2360 public static IPath getResolvedVariablePath(IPath variablePath) {
 
2362         if (variablePath == null)
 
2364         int count = variablePath.segmentCount();
 
2369         String variableName = variablePath.segment(0);
 
2370         IPath resolvedPath = JavaCore.getClasspathVariable(variableName);
 
2371         if (resolvedPath == null)
 
2374         // append path suffix
 
2376                 resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1));
 
2378         return resolvedPath; 
 
2382  * Answers the shared working copies currently registered for this buffer factory. 
 
2383  * Working copies can be shared by several clients using the same buffer factory,see 
 
2384  * <code>IWorkingCopy.getSharedWorkingCopy</code>.
 
2386  * @param factory the given buffer factory
 
2387  * @return the list of shared working copies for a given buffer factory
 
2391 public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){
 
2393         // if factory is null, default factory must be used
 
2394         if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
 
2395         Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies;
 
2397         Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory);
 
2398         if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy;
 
2399         Collection copies = perFactoryWorkingCopies.values();
 
2400         IWorkingCopy[] result = new IWorkingCopy[copies.size()];
 
2401         copies.toArray(result);
 
2406  * Initializes the default preferences settings for this plug-in.
 
2408 public static void initializeDefaultPluginPreferences() {
 
2410         Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences();
 
2411         HashSet optionNames = JavaModelManager.OptionNames;
 
2413         // Compiler settings
 
2414         preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE);
 
2415         optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR);
 
2417         preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); 
 
2418         optionNames.add(COMPILER_LINE_NUMBER_ATTR);
 
2420         preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); 
 
2421         optionNames.add(COMPILER_SOURCE_FILE_ATTR);
 
2423         preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); 
 
2424         optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL);
 
2426         preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); 
 
2427         optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM);
 
2429         preferences.setDefault(COMPILER_PB_PHP_VAR_DEPRECATED, WARNING); 
 
2430         optionNames.add(COMPILER_PB_PHP_VAR_DEPRECATED);
 
2432         preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); 
 
2433         optionNames.add(COMPILER_PB_UNREACHABLE_CODE);
 
2435         preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); 
 
2436         optionNames.add(COMPILER_PB_INVALID_IMPORT);
 
2438         preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); 
 
2439         optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD);
 
2441         preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); 
 
2442         optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
 
2444         preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING);
 
2445         optionNames.add(COMPILER_PB_DEPRECATION);
 
2447         preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED);
 
2448         optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE);
 
2450         preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); 
 
2451         optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK);
 
2453         preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); 
 
2454         optionNames.add(COMPILER_PB_UNUSED_LOCAL);
 
2456         preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); 
 
2457         optionNames.add(COMPILER_PB_UNUSED_PARAMETER);
 
2459         preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); 
 
2460         optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT);
 
2462         preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); 
 
2463         optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE);
 
2465         preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); 
 
2466         optionNames.add(COMPILER_PB_UNUSED_IMPORT);
 
2468         preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); 
 
2469         optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER);
 
2471         preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); 
 
2472         optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION);
 
2474         preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); 
 
2475         optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL);
 
2477         preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); 
 
2478         optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER);
 
2480         preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); 
 
2481         optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER);
 
2483         preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); 
 
2484         optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT);
 
2486         preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); 
 
2487         optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD);
 
2489         preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); 
 
2490         optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION);
 
2492         preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$
 
2493         optionNames.add(COMPILER_TASK_TAGS);
 
2495         preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$
 
2496         optionNames.add(COMPILER_TASK_PRIORITIES);
 
2498         preferences.setDefault(COMPILER_SOURCE, VERSION_1_3);
 
2499         optionNames.add(COMPILER_SOURCE);
 
2501         preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); 
 
2502         optionNames.add(COMPILER_COMPLIANCE);
 
2504         preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$
 
2505         optionNames.add(COMPILER_PB_MAX_PER_UNIT);
 
2508         preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$
 
2509         optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER);
 
2511         preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); 
 
2512         optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH);
 
2514         preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); 
 
2515         optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE);
 
2517         preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); 
 
2518         optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER);
 
2520         // JavaCore settings
 
2521         preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); 
 
2522         optionNames.add(CORE_JAVA_BUILD_ORDER);
 
2524         preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); 
 
2525         optionNames.add(CORE_CIRCULAR_CLASSPATH);
 
2527         preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); 
 
2528         optionNames.add(CORE_INCOMPLETE_CLASSPATH);
 
2530         preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); 
 
2531         optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS);
 
2533         preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); 
 
2534         optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS);
 
2536         // encoding setting comes from resource plug-in
 
2537         optionNames.add(CORE_ENCODING);
 
2539         // Formatter settings
 
2540         preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); 
 
2541         optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE);
 
2543         preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT);
 
2544         optionNames.add(FORMATTER_NEWLINE_CONTROL);
 
2546         preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); 
 
2547         optionNames.add(FORMATTER_CLEAR_BLANK_LINES);
 
2549         preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT);
 
2550         optionNames.add(FORMATTER_NEWLINE_ELSE_IF);
 
2552         preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); 
 
2553         optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK);
 
2555         preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$
 
2556         optionNames.add(FORMATTER_LINE_SPLIT);
 
2558         preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); 
 
2559         optionNames.add(FORMATTER_COMPACT_ASSIGNMENT);
 
2561         preferences.setDefault(FORMATTER_TAB_CHAR, TAB); 
 
2562         optionNames.add(FORMATTER_TAB_CHAR);
 
2564         preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ 
 
2565         optionNames.add(FORMATTER_TAB_SIZE);
 
2567         preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ 
 
2568         optionNames.add(FORMATTER_SPACE_CASTEXPRESSION);
 
2570         // CodeAssist settings
 
2571         preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$
 
2572         optionNames.add(CODEASSIST_VISIBILITY_CHECK);
 
2574         preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$
 
2575         optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION);
 
2577         preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$
 
2578         optionNames.add(CODEASSIST_FIELD_PREFIXES);
 
2580         preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$
 
2581         optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES);
 
2583         preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$
 
2584         optionNames.add(CODEASSIST_LOCAL_PREFIXES);
 
2586         preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$
 
2587         optionNames.add(CODEASSIST_ARGUMENT_PREFIXES);
 
2589         preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$
 
2590         optionNames.add(CODEASSIST_FIELD_SUFFIXES);
 
2592         preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$
 
2593         optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES);
 
2595         preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$
 
2596         optionNames.add(CODEASSIST_LOCAL_SUFFIXES);
 
2598         preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$
 
2599         optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES);
 
2603  * Returns whether the given marker references the given Java element.
 
2604  * Used for markers, which denote a Java element rather than a resource.
 
2606  * @param element the element
 
2607  * @param marker the marker
 
2608  * @return <code>true</code> if the marker references the element, false otherwise
 
2609  * @exception CoreException if the <code>IMarker.getAttribute</code> on the marker fails         
 
2611 public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException {
 
2613         // only match units or classfiles
 
2614         if (element instanceof IMember){
 
2615                 IMember member = (IMember) element;
 
2616                 if (member.isBinary()){
 
2617                         element = null; //member.getClassFile();
 
2619                         element = member.getCompilationUnit();
 
2622         if (element == null) return false;                      
 
2623         if (marker == null) return false;
 
2625         String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID);
 
2626         if (markerHandleId == null) return false;
 
2628         IJavaElement markerElement = JavaCore.create(markerHandleId);
 
2630                 if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
 
2632                 // cycle through enclosing types in case marker is associated with a classfile (15568)
 
2633 //              if (markerElement instanceof IClassFile){
 
2634 //                      IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
 
2635 //                      if (enclosingType != null){
 
2636 //                              markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
 
2646  * Returns whether the given marker delta references the given Java element.
 
2647  * Used for markers deltas, which denote a Java element rather than a resource.
 
2649  * @param element the element
 
2650  * @param markerDelta the marker delta
 
2651  * @return <code>true</code> if the marker delta references the element
 
2652  * @exception CoreException if the  <code>IMarkerDelta.getAttribute</code> on the marker delta fails     
 
2654 public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException {
 
2656         // only match units or classfiles
 
2657         if (element instanceof IMember){
 
2658                 IMember member = (IMember) element;
 
2659                 if (member.isBinary()){
 
2660                         element = null; //member.getClassFile();
 
2662                         element = member.getCompilationUnit();
 
2665         if (element == null) return false;                      
 
2666         if (markerDelta == null) return false;
 
2668         String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID);
 
2669         if (markerDeltarHandleId == null) return false;
 
2671         IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
 
2673                 if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
 
2675                 // cycle through enclosing types in case marker is associated with a classfile (15568)
 
2676 //              if (markerElement instanceof IClassFile){
 
2677 //                      IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
 
2678 //                      if (enclosingType != null){
 
2679 //                              markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
 
2689  * Creates and returns a new classpath entry of kind <code>CPE_CONTAINER</code>
 
2690  * for the given path. The path of the container will be used during resolution so as to map this
 
2691  * container entry to a set of other classpath entries the container is acting for.
 
2693  * A container entry allows to express indirect references to a set of libraries, projects and variable entries,
 
2694  * which can be interpreted differently for each Java project where it is used.
 
2695  * A classpath container entry can be resolved using <code>JavaCore.getResolvedClasspathContainer</code>,
 
2696  * and updated with <code>JavaCore.classpathContainerChanged</code>
 
2698  * A container is exclusively resolved by a <code>ClasspathContainerInitializer</code> registered onto the
 
2699  * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
 
2701  * A container path must be formed of at least one segment, where: <ul>
 
2702  * <li> the first segment is a unique ID identifying the target container, there must be a container initializer registered
 
2703  *      onto this ID through the extension point  "org.eclipse.jdt.core.classpathContainerInitializer". </li>
 
2704  * <li> the remaining segments will be passed onto the initializer, and can be used as additional
 
2705  *      hints during the initialization phase. </li>
 
2708  * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container:
 
2710  * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default"));
 
2713  *    point="org.eclipse.jdt.core.classpathContainerInitializer">
 
2714  *    <containerInitializer
 
2715  *       id="MyProvidedJDK"
 
2716  *       class="com.example.MyInitializer"/> 
 
2718  * Note that this operation does not attempt to validate classpath containers
 
2719  * or access the resources at the given paths.
 
2721  * The resulting entry is not exported to dependent projects. This method is equivalent to
 
2722  * <code>newContainerEntry(-,false)</code>.
 
2724  * @param containerPath the path identifying the container, it must be formed of two
 
2726  * @return a new container classpath entry
 
2728  * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
 
2729  * @see JavaCore#newContainerEntry(IPath, boolean)
 
2732 public static IClasspathEntry newContainerEntry(IPath containerPath) {
 
2734         return newContainerEntry(containerPath, false);
 
2738  * Creates and returns a new classpath entry of kind <code>CPE_CONTAINER</code>
 
2739  * for the given path. The path of the container will be used during resolution so as to map this
 
2740  * container entry to a set of other classpath entries the container is acting for.
 
2742  * A container entry allows to express indirect references to a set of libraries, projects and variable entries,
 
2743  * which can be interpreted differently for each Java project where it is used.
 
2744  * A classpath container entry can be resolved using <code>JavaCore.getResolvedClasspathContainer</code>,
 
2745  * and updated with <code>JavaCore.classpathContainerChanged</code>
 
2747  * A container is exclusively resolved by a <code>ClasspathContainerInitializer</code> registered onto the
 
2748  * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
 
2750  * A container path must be formed of at least one segment, where: <ul>
 
2751  * <li> the first segment is a unique ID identifying the target container, there must be a container initializer registered
 
2752  *      onto this ID through the extension point  "org.eclipse.jdt.core.classpathContainerInitializer". </li>
 
2753  * <li> the remaining segments will be passed onto the initializer, and can be used as additional
 
2754  *      hints during the initialization phase. </li>
 
2757  * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container:
 
2759  * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default"));
 
2762  *    point="org.eclipse.jdt.core.classpathContainerInitializer">
 
2763  *    <containerInitializer
 
2764  *       id="MyProvidedJDK"
 
2765  *       class="com.example.MyInitializer"/> 
 
2767  * Note that this operation does not attempt to validate classpath containers
 
2768  * or access the resources at the given paths.
 
2770  * @param containerPath the path identifying the container, it must be formed of at least
 
2771  *      one segment (ID+hints)
 
2772  * @param isExported a boolean indicating whether this entry is contributed to dependent
 
2773  *    projects in addition to the output location
 
2774  * @return a new container classpath entry
 
2776  * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
 
2777  * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
 
2778  * @see JavaCore#newContainerEntry(IPath, boolean)
 
2781 public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) {
 
2783         if (containerPath == null || containerPath.segmentCount() < 1) {
 
2786                         "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
 
2788         return new ClasspathEntry(
 
2789                 IPackageFragmentRoot.K_SOURCE,
 
2790                 IClasspathEntry.CPE_CONTAINER,
 
2792                 ClasspathEntry.NO_EXCLUSION_PATTERNS, 
 
2793                 null, // source attachment
 
2794                 null, // source attachment root
 
2795                 null, // specific output folder
 
2800  * Creates and returns a new non-exported classpath entry of kind <code>CPE_LIBRARY</code> for the 
 
2801  * JAR or folder identified by the given absolute path. This specifies that all package fragments 
 
2802  * within the root will have children of type <code>IClassFile</code>.
 
2804  * A library entry is used to denote a prerequisite JAR or root folder containing binaries.
 
2805  * The target JAR or folder can either be defined internally to the workspace (absolute path relative
 
2806  * to the workspace root) or externally to the workspace (absolute path in the file system).
 
2808  * e.g. Here are some examples of binary path usage<ul>
 
2809  *      <li><code> "c:/jdk1.2.2/jre/lib/rt.jar" </code> - reference to an external JAR</li>
 
2810  *      <li><code> "/Project/someLib.jar" </code> - reference to an internal JAR </li>
 
2811  *      <li><code> "c:/classes/" </code> - reference to an external binary folder</li>
 
2813  * Note that this operation does not attempt to validate or access the 
 
2814  * resources at the given paths.
 
2816  * The resulting entry is not exported to dependent projects. This method is equivalent to
 
2817  * <code>newLibraryEntry(-,-,-,false)</code>.
 
2820  * @param path the absolute path of the binary archive
 
2821  * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, 
 
2822  *    or <code>null</code> if none
 
2823  * @param sourceAttachmentRootPath the location of the root within the source archive or folder
 
2824  *    or <code>null</code> if this location should be automatically detected.
 
2825  * @return a new library classpath entry
 
2827  * @see #newLibraryEntry(IPath, IPath, IPath, boolean)
 
2829 //public static IClasspathEntry newLibraryEntry(
 
2831 //      IPath sourceAttachmentPath,
 
2832 //      IPath sourceAttachmentRootPath) {
 
2834 //      return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false);
 
2838  * Creates and returns a new classpath entry of kind <code>CPE_LIBRARY</code> for the JAR or folder
 
2839  * identified by the given absolute path. This specifies that all package fragments within the root 
 
2840  * will have children of type <code>IClassFile</code>.
 
2842  * A library entry is used to denote a prerequisite JAR or root folder containing binaries.
 
2843  * The target JAR or folder can either be defined internally to the workspace (absolute path relative
 
2844  * to the workspace root) or externally to the workspace (absolute path in the file system).
 
2846  * e.g. Here are some examples of binary path usage<ul>
 
2847  *      <li><code> "c:/jdk1.2.2/jre/lib/rt.jar" </code> - reference to an external JAR</li>
 
2848  *      <li><code> "/Project/someLib.jar" </code> - reference to an internal JAR </li>
 
2849  *      <li><code> "c:/classes/" </code> - reference to an external binary folder</li>
 
2851  * Note that this operation does not attempt to validate or access the 
 
2852  * resources at the given paths.
 
2855  * @param path the absolute path of the binary archive
 
2856  * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, 
 
2857  *    or <code>null</code> if none
 
2858  * @param sourceAttachmentRootPath the location of the root within the source archive or folder
 
2859  *    or <code>null</code> if this location should be automatically detected.
 
2860  * @param isExported indicates whether this entry is contributed to dependent
 
2861  *        projects in addition to the output location
 
2862  * @return a new library classpath entry
 
2865 //public static IClasspathEntry newLibraryEntry(
 
2867 //      IPath sourceAttachmentPath,
 
2868 //      IPath sourceAttachmentRootPath,
 
2869 //      boolean isExported) {
 
2871 //      if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
 
2873 //      return new ClasspathEntry(
 
2874 //              IPackageFragmentRoot.K_BINARY,
 
2875 //              IClasspathEntry.CPE_LIBRARY,
 
2876 //              JavaProject.canonicalizedPath(path),
 
2877 //              ClasspathEntry.NO_EXCLUSION_PATTERNS, 
 
2878 //              sourceAttachmentPath,
 
2879 //              sourceAttachmentRootPath,
 
2880 //              null, // specific output folder
 
2885  * Creates and returns a new non-exported classpath entry of kind <code>CPE_PROJECT</code>
 
2886  * for the project identified by the given absolute path.
 
2888  * A project entry is used to denote a prerequisite project on a classpath.
 
2889  * The referenced project will be contributed as a whole, either as sources (in the Java Model, it
 
2890  * contributes all its package fragment roots) or as binaries (when building, it contributes its 
 
2891  * whole output location).
 
2893  * A project reference allows to indirect through another project, independently from its internal layout. 
 
2895  * The prerequisite project is referred to using an absolute path relative to the workspace root.
 
2897  * The resulting entry is not exported to dependent projects. This method is equivalent to
 
2898  * <code>newProjectEntry(_,false)</code>.
 
2901  * @param path the absolute path of the binary archive
 
2902  * @return a new project classpath entry
 
2904  * @see JavaCore#newProjectEntry(IPath, boolean)
 
2906 public static IClasspathEntry newProjectEntry(IPath path) {
 
2907         return newProjectEntry(path, false);
 
2911  * Creates and returns a new classpath entry of kind <code>CPE_PROJECT</code>
 
2912  * for the project identified by the given absolute path.
 
2914  * A project entry is used to denote a prerequisite project on a classpath.
 
2915  * The referenced project will be contributed as a whole, either as sources (in the Java Model, it
 
2916  * contributes all its package fragment roots) or as binaries (when building, it contributes its 
 
2917  * whole output location).
 
2919  * A project reference allows to indirect through another project, independently from its internal layout. 
 
2921  * The prerequisite project is referred to using an absolute path relative to the workspace root.
 
2924  * @param path the absolute path of the prerequisite project
 
2925  * @param isExported indicates whether this entry is contributed to dependent
 
2926  *        projects in addition to the output location
 
2927  * @return a new project classpath entry
 
2930 public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
 
2932         if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
 
2934         return new ClasspathEntry(
 
2935                 IPackageFragmentRoot.K_SOURCE,
 
2936                 IClasspathEntry.CPE_PROJECT,
 
2938                 ClasspathEntry.NO_EXCLUSION_PATTERNS, 
 
2939                 null, // source attachment
 
2940                 null, // source attachment root
 
2941                 null, // specific output folder
 
2946  * Returns a new empty region.
 
2948  * @return a new empty region
 
2950 public static IRegion newRegion() {
 
2951         return new Region();
 
2955  * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
 
2956  * for the project's source folder identified by the given absolute 
 
2957  * workspace-relative path. This specifies that all package fragments
 
2958  * within the root will have children of type <code>ICompilationUnit</code>.
 
2960  * The source folder is referred to using an absolute path relative to the
 
2961  * workspace root, e.g. <code>/Project/src</code>. A project's source 
 
2962  * folders are located with that project. That is, a source classpath
 
2963  * entry specifying the path <code>/P1/src</code> is only usable for
 
2964  * project <code>P1</code>.
 
2967  * The source classpath entry created by this method includes all source
 
2968  * files below the given workspace-relative path. To selectively exclude
 
2969  * some of these source files, use the factory method 
 
2970  * <code>JavaCore.newSourceEntry(IPath,IPath[])</code> instead.
 
2973  * Note that all sources/binaries inside a project are contributed as a whole through
 
2974  * a project entry (see <code>JavaCore.newProjectEntry</code>). Particular
 
2975  * source entries cannot be selectively exported.
 
2978  * @param path the absolute workspace-relative path of a source folder
 
2979  * @return a new source classpath entry with not exclusion patterns
 
2981  * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[])
 
2983 public static IClasspathEntry newSourceEntry(IPath path) {
 
2985         return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/);
 
2989  * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
 
2990  * for the project's source folder identified by the given absolute 
 
2991  * workspace-relative path but excluding all source files with paths
 
2992  * matching any of the given patterns. This specifies that all package
 
2993  * fragments within the root will have children of type 
 
2994  * <code>ICompilationUnit</code>.
 
2996  * The source folder is referred to using an absolute path relative to the
 
2997  * workspace root, e.g. <code>/Project/src</code>. A project's source 
 
2998  * folders are located with that project. That is, a source classpath
 
2999  * entry specifying the path <code>/P1/src</code> is only usable for
 
3000  * project <code>P1</code>.
 
3003  * The source classpath entry created by this method includes all source
 
3004  * files below the given workspace-relative path except for those matched
 
3005  * by one (or more) of the given exclusion patterns. Each exclusion pattern
 
3006  * is represented by a relative path, which is interpreted as relative to
 
3007  * the source folder. For example, if the source folder path is 
 
3008  * <code>/Project/src</code> and the exclusion pattern is 
 
3009  * <code>com/xyz/tests/**</code>, then source files
 
3010  * like <code>/Project/src/com/xyz/Foo.java</code>
 
3011  * and <code>/Project/src/com/xyz/utils/Bar.java</code> would be included,
 
3012  * whereas <code>/Project/src/com/xyz/tests/T1.java</code>
 
3013  * and <code>/Project/src/com/xyz/tests/quick/T2.java</code> would be
 
3014  * excluded. Exclusion patterns can contain can contain '**', '*' or '?'
 
3015  * wildcards; see <code>IClasspathEntry.getExclusionPatterns</code>
 
3016  * for the full description of the syntax and semantics of exclusion
 
3019  * If the empty list of exclusion patterns is specified, the source folder
 
3020  * will automatically include all resources located inside the source
 
3021  * folder. In that case, the result is entirely equivalent to using the
 
3022  * factory method <code>JavaCore.newSourceEntry(IPath)</code>. 
 
3025  * Note that all sources/binaries inside a project are contributed as a whole through
 
3026  * a project entry (see <code>JavaCore.newProjectEntry</code>). Particular
 
3027  * source entries cannot be selectively exported.
 
3030  * @param path the absolute workspace-relative path of a source folder
 
3031  * @param exclusionPatterns the possibly empty list of exclusion patterns
 
3032  *    represented as relative paths
 
3033  * @return a new source classpath entry with the given exclusion patterns
 
3034  * @see #newSourceEntry(org.eclipse.core.runtime.IPath)
 
3035  * @see IClasspathEntry#getExclusionPatterns
 
3039 public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
 
3041         return newSourceEntry(path, exclusionPatterns, null /*output location*/); 
 
3045  * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
 
3046  * for the project's source folder identified by the given absolute 
 
3047  * workspace-relative path but excluding all source files with paths
 
3048  * matching any of the given patterns, and associated with a specific output location
 
3049  * (that is, ".class" files are not going to the project default output location). 
 
3050  * All package fragments within the root will have children of type 
 
3051  * <code>ICompilationUnit</code>.
 
3053  * The source folder is referred to using an absolute path relative to the
 
3054  * workspace root, e.g. <code>/Project/src</code>. A project's source 
 
3055  * folders are located with that project. That is, a source classpath
 
3056  * entry specifying the path <code>/P1/src</code> is only usable for
 
3057  * project <code>P1</code>.
 
3060  * The source classpath entry created by this method includes all source
 
3061  * files below the given workspace-relative path except for those matched
 
3062  * by one (or more) of the given exclusion patterns. Each exclusion pattern
 
3063  * is represented by a relative path, which is interpreted as relative to
 
3064  * the source folder. For example, if the source folder path is 
 
3065  * <code>/Project/src</code> and the exclusion pattern is 
 
3066  * <code>com/xyz/tests/**</code>, then source files
 
3067  * like <code>/Project/src/com/xyz/Foo.java</code>
 
3068  * and <code>/Project/src/com/xyz/utils/Bar.java</code> would be included,
 
3069  * whereas <code>/Project/src/com/xyz/tests/T1.java</code>
 
3070  * and <code>/Project/src/com/xyz/tests/quick/T2.java</code> would be
 
3071  * excluded. Exclusion patterns can contain can contain '**', '*' or '?'
 
3072  * wildcards; see <code>IClasspathEntry.getExclusionPatterns</code>
 
3073  * for the full description of the syntax and semantics of exclusion
 
3076  * If the empty list of exclusion patterns is specified, the source folder
 
3077  * will automatically include all resources located inside the source
 
3078  * folder. In that case, the result is entirely equivalent to using the
 
3079  * factory method <code>JavaCore.newSourceEntry(IPath)</code>. 
 
3082  * Additionally, a source entry can be associated with a specific output location. 
 
3083  * By doing so, the Java builder will ensure that the generated ".class" files will 
 
3084  * be issued inside this output location, as opposed to be generated into the 
 
3085  * project default output location (when output location is <code>null</code>). 
 
3086  * Note that multiple source entries may target the same output location.
 
3087  * The output location is referred to using an absolute path relative to the 
 
3088  * workspace root, e.g. <code>"/Project/bin"</code>, it must be located inside 
 
3089  * the same project as the source folder.
 
3092  * Also note that all sources/binaries inside a project are contributed as a whole through
 
3093  * a project entry (see <code>JavaCore.newProjectEntry</code>). Particular
 
3094  * source entries cannot be selectively exported.
 
3097  * @param path the absolute workspace-relative path of a source folder
 
3098  * @param exclusionPatterns the possibly empty list of exclusion patterns
 
3099  *    represented as relative paths
 
3100  * @param outputLocation the specific output location for this source entry (<code>null</code> if using project default ouput location)
 
3101  * @return a new source classpath entry with the given exclusion patterns
 
3102  * @see #newSourceEntry(org.eclipse.core.runtime.IPath)
 
3103  * @see IClasspathEntry#getExclusionPatterns
 
3104  * @see IClasspathEntry#getOutputLocation()
 
3108 public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) {
 
3110         if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
 
3111         if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
 
3113         return new ClasspathEntry(
 
3114                 IPackageFragmentRoot.K_SOURCE,
 
3115                 IClasspathEntry.CPE_SOURCE,
 
3118                 null, // source attachment
 
3119                 null, // source attachment root
 
3120                 specificOutputLocation, // custom output location
 
3125  * Creates and returns a new non-exported classpath entry of kind <code>CPE_VARIABLE</code>
 
3126  * for the given path. The first segment of the path is the name of a classpath variable.
 
3127  * The trailing segments of the path will be appended to resolved variable path.
 
3129  * A variable entry allows to express indirect references on a classpath to other projects or libraries,
 
3130  * depending on what the classpath variable is referring.
 
3132  *      It is possible to register an automatic initializer (<code>ClasspathVariableInitializer</code>),
 
3133  * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
 
3134  * After resolution, a classpath variable entry may either correspond to a project or a library entry. </li>     
 
3136  * e.g. Here are some examples of variable path usage<ul>
 
3137  * <li> "JDTCORE" where variable <code>JDTCORE</code> is 
 
3138  *              bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"</li>
 
3139  * <li> "JDTCORE" where variable <code>JDTCORE</code> is 
 
3140  *              bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"</li>
 
3141  * <li> "PLUGINS/com.example/example.jar" where variable <code>PLUGINS</code>
 
3142  *      is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"</li>
 
3144  * Note that this operation does not attempt to validate classpath variables
 
3145  * or access the resources at the given paths.
 
3147  * The resulting entry is not exported to dependent projects. This method is equivalent to
 
3148  * <code>newVariableEntry(-,-,-,false)</code>.
 
3151  * @param variablePath the path of the binary archive; first segment is the
 
3152  *   name of a classpath variable
 
3153  * @param variableSourceAttachmentPath the path of the corresponding source archive, 
 
3154  *    or <code>null</code> if none; if present, the first segment is the
 
3155  *    name of a classpath variable (not necessarily the same variable
 
3156  *    as the one that begins <code>variablePath</code>)
 
3157  * @param sourceAttachmentRootPath the location of the root within the source archive
 
3158  *    or <code>null</code> if <code>archivePath</code> is also <code>null</code>
 
3159  * @return a new library classpath entry
 
3161  * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean)
 
3163 //public static IClasspathEntry newVariableEntry(
 
3164 //      IPath variablePath,
 
3165 //      IPath variableSourceAttachmentPath,
 
3166 //      IPath sourceAttachmentRootPath) {
 
3168 //      return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false);
 
3172  * Creates and returns a new non-exported classpath entry of kind <code>CPE_VARIABLE</code>
 
3173  * for the given path. The first segment of the path is the name of a classpath variable.
 
3174  * The trailing segments of the path will be appended to resolved variable path.
 
3176  * A variable entry allows to express indirect references on a classpath to other projects or libraries,
 
3177  * depending on what the classpath variable is referring.
 
3179  *      It is possible to register an automatic initializer (<code>ClasspathVariableInitializer</code>),
 
3180  * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
 
3181  * After resolution, a classpath variable entry may either correspond to a project or a library entry. </li>     
 
3183  * e.g. Here are some examples of variable path usage<ul>
 
3184  * <li> "JDTCORE" where variable <code>JDTCORE</code> is 
 
3185  *              bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"</li>
 
3186  * <li> "JDTCORE" where variable <code>JDTCORE</code> is 
 
3187  *              bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"</li>
 
3188  * <li> "PLUGINS/com.example/example.jar" where variable <code>PLUGINS</code>
 
3189  *      is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"</li>
 
3191  * Note that this operation does not attempt to validate classpath variables
 
3192  * or access the resources at the given paths.
 
3195  * @param variablePath the path of the binary archive; first segment is the
 
3196  *   name of a classpath variable
 
3197  * @param variableSourceAttachmentPath the path of the corresponding source archive, 
 
3198  *    or <code>null</code> if none; if present, the first segment is the
 
3199  *    name of a classpath variable (not necessarily the same variable
 
3200  *    as the one that begins <code>variablePath</code>)
 
3201  * @param sourceAttachmentRootPath the location of the root within the source archive
 
3202  *    or <code>null</code> if <code>archivePath</code> is also <code>null</code>
 
3203  * @param isExported indicates whether this entry is contributed to dependent
 
3204  *        projects in addition to the output location
 
3205  * @return a new variable classpath entry
 
3208 //public static IClasspathEntry newVariableEntry(
 
3209 //      IPath variablePath,
 
3210 //      IPath variableSourceAttachmentPath,
 
3211 //      IPath variableSourceAttachmentRootPath,
 
3212 //      boolean isExported) {
 
3214 //      if (variablePath == null || variablePath.segmentCount() < 1) {
 
3217 //                      "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$
 
3220 //      return new ClasspathEntry(
 
3221 //              IPackageFragmentRoot.K_SOURCE,
 
3222 //              IClasspathEntry.CPE_VARIABLE,
 
3224 //              ClasspathEntry.NO_EXCLUSION_PATTERNS, 
 
3225 //              variableSourceAttachmentPath, // source attachment
 
3226 //              variableSourceAttachmentRootPath, // source attachment root                     
 
3227 //              null, // specific output folder
 
3232  * Removed the given classpath variable. Does nothing if no value was
 
3233  * set for this classpath variable.
 
3235  * This functionality cannot be used while the resource tree is locked.
 
3237  * Classpath variable values are persisted locally to the workspace, and 
 
3238  * are preserved from session to session.
 
3241  * @param variableName the name of the classpath variable
 
3242  * @see #setClasspathVariable
 
3244  * @deprecated - use version with extra IProgressMonitor
 
3246 //public static void removeClasspathVariable(String variableName) {
 
3247 //      removeClasspathVariable(variableName, null);
 
3251  * Removed the given classpath variable. Does nothing if no value was
 
3252  * set for this classpath variable.
 
3254  * This functionality cannot be used while the resource tree is locked.
 
3256  * Classpath variable values are persisted locally to the workspace, and 
 
3257  * are preserved from session to session.
 
3260  * @param variableName the name of the classpath variable
 
3261  * @param monitor the progress monitor to report progress
 
3262  * @see #setClasspathVariable
 
3264 //public static void removeClasspathVariable(
 
3265 //      String variableName,
 
3266 //      IProgressMonitor monitor) {
 
3269 //              updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor);
 
3270 //      } catch (JavaModelException e) {
 
3275  * Removes the given element changed listener.
 
3276  * Has no affect if an identical listener is not registered.
 
3278  * @param listener the listener
 
3280 public static void removeElementChangedListener(IElementChangedListener listener) {
 
3281         JavaModelManager.getJavaModelManager().removeElementChangedListener(listener);
 
3285  * Bind a container reference path to some actual containers (<code>IClasspathContainer</code>).
 
3286  * This API must be invoked whenever changes in container need to be reflected onto the JavaModel.
 
3287  * Containers can have distinct values in different projects, therefore this API considers a
 
3288  * set of projects with their respective containers.
 
3290  * <code>containerPath</code> is the path under which these values can be referenced through
 
3291  * container classpath entries (<code>IClasspathEntry#CPE_CONTAINER</code>). A container path 
 
3292  * is formed by a first ID segment followed with extra segments, which can be used as additional hints
 
3293  * for the resolution. The container ID is used to identify a <code>ClasspathContainerInitializer</code> 
 
3294  * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
 
3296  * There is no assumption that each individual container value passed in argument 
 
3297  * (<code>respectiveContainers</code>) must answer the exact same path when requested 
 
3298  * <code>IClasspathContainer#getPath</code>. 
 
3299  * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be 
 
3300  * delegated to a <code>ClasspathContainerInitializer</code>, which can be activated through the extension
 
3301  * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). 
 
3303  * In reaction to changing container values, the JavaModel will be updated to reflect the new
 
3304  * state of the updated container. 
 
3306  * This functionality cannot be used while the resource tree is locked.
 
3308  * Classpath container values are persisted locally to the workspace, but 
 
3309  * are not preserved from a session to another. It is thus highly recommended to register a 
 
3310  * <code>ClasspathContainerInitializer</code> for each referenced container 
 
3311  * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
 
3313  * Note: setting a container to <code>null</code> will cause it to be lazily resolved again whenever
 
3314  * its value is required. In particular, this will cause a registered initializer to be invoked
 
3317  * @param containerPath - the name of the container reference, which is being updated
 
3318  * @param affectedProjects - the set of projects for which this container is being bound
 
3319  * @param respectiveContainers - the set of respective containers for the affected projects
 
3320  * @param monitor a monitor to report progress
 
3322  * @see ClasspathContainerInitializer
 
3323  * @see #getClasspathContainer(IPath, IJavaProject)
 
3324  * @see IClasspathContainer
 
3327 //public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException {
 
3329 //      if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$
 
3331 //      if (monitor != null && monitor.isCanceled()) return;
 
3333 //      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3334 //              System.out.println("CPContainer SET  - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$
 
3335 //                      + (Util.toString(affectedProjects, 
 
3336 //                                      new Util.Displayable(){ 
 
3337 //                                              public String displayString(Object o) { return ((IJavaProject) o).getElementName(); }
 
3339 //                      + "} with values: " //$NON-NLS-1$
 
3340 //                      + (Util.toString(respectiveContainers, 
 
3341 //                                      new Util.Displayable(){ 
 
3342 //                                              public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); }
 
3347 //      final int projectLength = affectedProjects.length;
 
3348 //      final IJavaProject[] modifiedProjects;
 
3349 //      System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength);
 
3350 //      final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][];
 
3352 //      // filter out unmodified project containers
 
3353 //      int remaining = 0;
 
3354 //      for (int i = 0; i < projectLength; i++){
 
3356 //              if (monitor != null && monitor.isCanceled()) return;
 
3358 //              IJavaProject affectedProject = affectedProjects[i];
 
3359 //              IClasspathContainer newContainer = respectiveContainers[i];
 
3360 //              if (newContainer == null) newContainer = JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent infinite loop
 
3361 //              boolean found = false;
 
3362 //              if (JavaProject.hasJavaNature(affectedProject.getProject())){
 
3363 //                      IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath();
 
3364 //                      for (int j = 0, cpLength = rawClasspath.length; j <cpLength; j++) {
 
3365 //                              IClasspathEntry entry = rawClasspath[j];
 
3366 //                              if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && entry.getPath().equals(containerPath)){
 
3373 //                      modifiedProjects[i] = null; // filter out this project - does not reference the container path, or isnt't yet Java project
 
3374 //                      JavaModelManager.containerPut(affectedProject, containerPath, newContainer);
 
3377 //              IClasspathContainer oldContainer = JavaModelManager.containerGet(affectedProject, containerPath);
 
3378 //              if (oldContainer == JavaModelManager.ContainerInitializationInProgress) {
 
3379 //                      Map previousContainerValues = (Map)JavaModelManager.PreviousSessionContainers.get(affectedProject);
 
3380 //                      if (previousContainerValues != null){
 
3381 //                              IClasspathContainer previousContainer = (IClasspathContainer)previousContainerValues.get(containerPath);
 
3382 //                              if (previousContainer != null) {
 
3383 //                                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3384 //                                              System.out.println("CPContainer INIT - reentering access to project container: ["+affectedProject.getElementName()+"] " + containerPath + " during its initialization, will see previous value: "+ previousContainer.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
3386 //                                      JavaModelManager.containerPut(affectedProject, containerPath, previousContainer); 
 
3388 //                              oldContainer = null; //33695 - cannot filter out restored container, must update affected project to reset cached CP
 
3390 //                              oldContainer = null;
 
3393 //              if (oldContainer != null && oldContainer.equals(respectiveContainers[i])){// TODO: could improve to only compare entries
 
3394 //                      modifiedProjects[i] = null; // filter out this project - container did not change
 
3398 //              oldResolvedPaths[i] = affectedProject.getResolvedClasspath(true);
 
3399 //              JavaModelManager.containerPut(affectedProject, containerPath, newContainer);
 
3402 //      if (remaining == 0) return;
 
3404 //      // trigger model refresh
 
3406 //              JavaCore.run(new IWorkspaceRunnable() {
 
3407 //                      public void run(IProgressMonitor monitor) throws CoreException {
 
3408 //                              for(int i = 0; i < projectLength; i++){
 
3410 //                                      if (monitor != null && monitor.isCanceled()) return;
 
3412 //                                      JavaProject affectedProject = (JavaProject)modifiedProjects[i];
 
3413 //                                      if (affectedProject == null) continue; // was filtered out
 
3415 //                                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3416 //                                              System.out.println("CPContainer SET  - updating affected project: ["+affectedProject.getElementName()+"] due to setting container: " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$
 
3419 //                                      // force a refresh of the affected project (will compute deltas)
 
3420 //                                      affectedProject.setRawClasspath(
 
3421 //                                                      affectedProject.getRawClasspath(),
 
3422 //                                                      SetClasspathOperation.ReuseOutputLocation,
 
3424 //                                                      !ResourcesPlugin.getWorkspace().isTreeLocked(), // can save resources
 
3425 //                                                      oldResolvedPaths[i],
 
3426 //                                                      false, // updating - no validation
 
3427 //                                                      false); // updating - no need to save
 
3432 //      } catch(CoreException e) {
 
3433 //              if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3434 //                      System.out.println("CPContainer SET  - FAILED DUE TO EXCEPTION: "+containerPath); //$NON-NLS-1$
 
3435 //                      e.printStackTrace();
 
3437 //              if (e instanceof JavaModelException) {
 
3438 //                      throw (JavaModelException)e;
 
3440 //                      throw new JavaModelException(e);
 
3443 //              for (int i = 0; i < projectLength; i++) {
 
3444 //                      if (respectiveContainers[i] == null) {
 
3445 //                              JavaModelManager.containerPut(affectedProjects[i], containerPath, null); // reset init in progress marker
 
3453  * Sets the value of the given classpath variable.
 
3454  * The path must have at least one segment.
 
3456  * This functionality cannot be used while the resource tree is locked.
 
3458  * Classpath variable values are persisted locally to the workspace, and 
 
3459  * are preserved from session to session.
 
3462  * @param variableName the name of the classpath variable
 
3463  * @param path the path
 
3464  * @see #getClasspathVariable
 
3466  * @deprecated - use API with IProgressMonitor
 
3468 //public static void setClasspathVariable(String variableName, IPath path)
 
3469 //      throws JavaModelException {
 
3471 //      setClasspathVariable(variableName, path, null);
 
3475  * Sets the value of the given classpath variable.
 
3476  * The path must not be null.
 
3478  * This functionality cannot be used while the resource tree is locked.
 
3480  * Classpath variable values are persisted locally to the workspace, and 
 
3481  * are preserved from session to session.
 
3483  * Updating a variable with the same value has no effect.
 
3485  * @param variableName the name of the classpath variable
 
3486  * @param path the path
 
3487  * @param monitor a monitor to report progress
 
3488  * @see #getClasspathVariable
 
3490 //public static void setClasspathVariable(
 
3491 //      String variableName,
 
3493 //      IProgressMonitor monitor)
 
3494 //      throws JavaModelException {
 
3496 //      if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$
 
3497 //      setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor);
 
3501  * Sets the values of all the given classpath variables at once.
 
3502  * Null paths can be used to request corresponding variable removal.
 
3504  * This functionality cannot be used while the resource tree is locked.
 
3506  * Classpath variable values are persisted locally to the workspace, and 
 
3507  * are preserved from session to session.
 
3509  * Updating a variable with the same value has no effect.
 
3511  * @param variableNames an array of names for the updated classpath variables
 
3512  * @param paths an array of path updates for the modified classpath variables (null
 
3513  *       meaning that the corresponding value will be removed
 
3514  * @param monitor a monitor to report progress
 
3515  * @see #getClasspathVariable
 
3518 //public static void setClasspathVariables(
 
3519 //      String[] variableNames,
 
3521 //      IProgressMonitor monitor)
 
3522 //      throws JavaModelException {
 
3524 //      if (variableNames.length != paths.length)       Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$
 
3525 //      //TODO: should check that null cannot be used as variable paths
 
3526 //      updateVariableValues(variableNames, paths, monitor);
 
3530  * Method declared on IExecutableExtension.
 
3531  * Record any necessary initialization data from the plugin.
 
3533 public void setInitializationData(
 
3534         IConfigurationElement cfig,
 
3535         String propertyName,
 
3537         throws CoreException {
 
3541  * Sets the current table of options. All and only the options explicitly included in the given table 
 
3542  * are remembered; all previous option settings are forgotten, including ones not explicitly
 
3545  * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
 
3548  * @param newOptions the new options (key type: <code>String</code>; value type: <code>String</code>),
 
3549  *   or <code>null</code> to reset all options to their default values
 
3550  * @see JavaCore#getDefaultOptions
 
3552 public static void setOptions(Hashtable newOptions) {
 
3554         // see #initializeDefaultPluginPreferences() for changing default settings
 
3555         Preferences preferences = getPlugin().getPluginPreferences();
 
3557         if (newOptions == null){
 
3558                 newOptions = JavaCore.getDefaultOptions();
 
3560         Enumeration keys = newOptions.keys();
 
3561         while (keys.hasMoreElements()){
 
3562                 String key = (String)keys.nextElement();
 
3563                 if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option
 
3564                 if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs
 
3565                 String value = (String)newOptions.get(key);
 
3566                 preferences.setValue(key, value);
 
3570         getPlugin().savePluginPreferences();
 
3574  * Shutdown the JavaCore plug-in.
 
3576  * De-registers the JavaModelManager as a resource changed listener and save participant.
 
3578  * @see org.eclipse.core.runtime.Plugin#shutdown()
 
3580 // moved to PHPeclipsePlugin#shutdown()
 
3581 //public void shutdown() {
 
3583 //      //savePluginPreferences();
 
3584 //      getPlugin().savePluginPreferences();
 
3585 //      IWorkspace workspace = ResourcesPlugin.getWorkspace();
 
3586 //      workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor);
 
3587 //      workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault());
 
3589 //      ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown();
 
3593  * Initiate the background indexing process.
 
3594  * This should be deferred after the plugin activation.
 
3596 //private void startIndexing() {
 
3598 //      JavaModelManager.getJavaModelManager().getIndexManager().reset();
 
3602  * Startup of the JavaCore plug-in.
 
3604  * Registers the JavaModelManager as a resource changed listener and save participant.
 
3605  * Starts the background indexing, and restore saved classpath variable values.
 
3607  * @see org.eclipse.core.runtime.Plugin#startup()
 
3610 // moved to PHPeclipsePlugin#startup()
 
3611 //public void startup() {
 
3613 //      JavaModelManager manager = JavaModelManager.getJavaModelManager();
 
3615 //              manager.configurePluginDebugOptions();
 
3617 //              // request state folder creation (workaround 19885)
 
3618 //              JavaCore.getPlugin().getStateLocation();
 
3620 //              // retrieve variable values
 
3621 //              JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener());
 
3622 ////    TODO : jsurfer temp-del
 
3623 ////            manager.loadVariablesAndContainers();
 
3625 //              IWorkspace workspace = ResourcesPlugin.getWorkspace();
 
3626 //              workspace.addResourceChangeListener(
 
3627 //                      manager.deltaProcessor,
 
3628 //                      IResourceChangeEvent.PRE_AUTO_BUILD
 
3629 //                              | IResourceChangeEvent.POST_AUTO_BUILD
 
3630 //                              | IResourceChangeEvent.POST_CHANGE
 
3631 //                              | IResourceChangeEvent.PRE_DELETE
 
3632 //                              | IResourceChangeEvent.PRE_CLOSE);
 
3634 ////            startIndexing();
 
3635 //              workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager);
 
3637 //      } catch (CoreException e) {
 
3638 //      } catch (RuntimeException e) {
 
3639 //              manager.shutdown();
 
3646  * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once.
 
3648 //private static void updateVariableValues(
 
3649 //      String[] variableNames,
 
3650 //      IPath[] variablePaths,
 
3651 //      IProgressMonitor monitor) throws JavaModelException {
 
3653 //      if (monitor != null && monitor.isCanceled()) return;
 
3655 //      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3656 //              System.out.println("CPVariable SET  - setting variables: {" + Util.toString(variableNames)  //$NON-NLS-1$
 
3657 //                      + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$
 
3660 //      int varLength = variableNames.length;
 
3662 //      // gather classpath information for updating
 
3663 //      final HashMap affectedProjects = new HashMap(5);
 
3664 //      JavaModelManager manager = JavaModelManager.getJavaModelManager();
 
3665 //      IJavaModel model = manager.getJavaModel();
 
3667 //      // filter out unmodified variables
 
3668 //      int discardCount = 0;
 
3669 //      for (int i = 0; i < varLength; i++){
 
3670 //              String variableName = variableNames[i];
 
3671 //              IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value 
 
3672 //              if (oldPath == JavaModelManager.VariableInitializationInProgress){
 
3673 //                      IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName);
 
3674 //                      if (previousPath != null){
 
3675 //                              if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3676 //                                      System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$
 
3678 //                              JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value
 
3680 //                      oldPath = null;  //33695 - cannot filter out restored variable, must update affected project to reset cached CP
 
3682 //              if (oldPath != null && oldPath.equals(variablePaths[i])){
 
3683 //                      variableNames[i] = null;
 
3687 //      if (discardCount > 0){
 
3688 //              if (discardCount == varLength) return;
 
3689 //              int changedLength = varLength - discardCount;
 
3690 //              String[] changedVariableNames = new String[changedLength];
 
3691 //              IPath[] changedVariablePaths = new IPath[changedLength];
 
3692 //              for (int i = 0, index = 0; i < varLength; i++){
 
3693 //                      if (variableNames[i] != null){
 
3694 //                              changedVariableNames[index] = variableNames[i];
 
3695 //                              changedVariablePaths[index] = variablePaths[i];
 
3699 //              variableNames = changedVariableNames;
 
3700 //              variablePaths = changedVariablePaths;
 
3701 //              varLength = changedLength;
 
3704 //      if (monitor != null && monitor.isCanceled()) return;
 
3706 //      if (model != null) {
 
3707 //              IJavaProject[] projects = model.getJavaProjects();
 
3708 //              nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){
 
3709 //                      IJavaProject project = projects[i];
 
3711 //                      // check to see if any of the modified variables is present on the classpath
 
3712 //                      IClasspathEntry[] classpath = project.getRawClasspath();
 
3713 //                      for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
 
3715 //                              IClasspathEntry entry = classpath[j];
 
3716 //                              for (int k = 0; k < varLength; k++){
 
3718 //                                      String variableName = variableNames[k];                                         
 
3719 //                                      if (entry.getEntryKind() ==  IClasspathEntry.CPE_VARIABLE){
 
3721 //                                              if (variableName.equals(entry.getPath().segment(0))){
 
3722 //                                                      affectedProjects.put(project, project.getResolvedClasspath(true));
 
3723 //                                                      continue nextProject;
 
3725 //                                              IPath sourcePath, sourceRootPath;
 
3726 //                                              if (((sourcePath = entry.getSourceAttachmentPath()) != null     && variableName.equals(sourcePath.segment(0)))
 
3727 //                                                      || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null      && variableName.equals(sourceRootPath.segment(0)))) {
 
3729 //                                                      affectedProjects.put(project, project.getResolvedClasspath(true));
 
3730 //                                                      continue nextProject;
 
3737 //      // update variables
 
3738 //      for (int i = 0; i < varLength; i++){
 
3739 //              JavaModelManager.variablePut(variableNames[i], variablePaths[i]);
 
3741 //      final String[] dbgVariableNames = variableNames;
 
3743 //      // update affected project classpaths
 
3744 //      if (!affectedProjects.isEmpty()) {
 
3746 //                      JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run(
 
3747 //                              new IWorkspaceRunnable() {
 
3748 //                                      public void run(IProgressMonitor monitor) throws CoreException {
 
3749 //                                              // propagate classpath change
 
3750 //                                              Iterator projectsToUpdate = affectedProjects.keySet().iterator();
 
3751 //                                              while (projectsToUpdate.hasNext()) {
 
3753 //                                                      if (monitor != null && monitor.isCanceled()) return;
 
3755 //                                                      JavaProject project = (JavaProject) projectsToUpdate.next();
 
3757 //                                                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3758 //                                                              System.out.println("CPVariable SET  - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$
 
3762 //                                                              .setRawClasspath(
 
3763 //                                                                      project.getRawClasspath(),
 
3764 //                                                                      SetClasspathOperation.ReuseOutputLocation,
 
3765 //                                                                      null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717)
 
3766 //                                                                      !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources
 
3767 //                                                                      (IClasspathEntry[]) affectedProjects.get(project),
 
3768 //                                                                      false, // updating - no validation
 
3769 //                                                                      false); // updating - no need to save
 
3774 //              } catch (CoreException e) {
 
3775 //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
 
3776 //                              System.out.println("CPVariable SET  - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$
 
3777 //                              e.printStackTrace();
 
3779 //                      if (e instanceof JavaModelException) {
 
3780 //                              throw (JavaModelException)e;
 
3782 //                              throw new JavaModelException(e);
 
3788  * Startup the JavaCore plug-in.
 
3790  * Registers the JavaModelManager as a resource changed listener and save participant.
 
3791  * Starts the background indexing, and restore saved classpath variable values.
 
3794  * @see org.eclipse.core.runtime.Plugin#start(BundleContext)
 
3796 public static void start(final Plugin plugin, BundleContext context) throws Exception {
 
3797 //      super.start(context);
 
3799         final JavaModelManager manager = JavaModelManager.getJavaModelManager();
 
3801                 manager.configurePluginDebugOptions();
 
3803                 // request state folder creation (workaround 19885)
 
3804                 JavaCore.getPlugin().getStateLocation();
 
3806                 // retrieve variable values
 
3807                 //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener());
 
3808 //              manager.loadVariablesAndContainers();
 
3810                 final IWorkspace workspace = ResourcesPlugin.getWorkspace();
 
3811                 workspace.addResourceChangeListener(
 
3813                         IResourceChangeEvent.PRE_BUILD
 
3814                                 | IResourceChangeEvent.POST_BUILD
 
3815                                 | IResourceChangeEvent.POST_CHANGE
 
3816                                 | IResourceChangeEvent.PRE_DELETE
 
3817                                 | IResourceChangeEvent.PRE_CLOSE);
 
3821                 // process deltas since last activated in indexer thread so that indexes are up-to-date.
 
3822                 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
 
3823                 Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
 
3824                         protected IStatus run(IProgressMonitor monitor) {
 
3826                                         // add save participant and process delta atomically
 
3827                                         // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
 
3829                                                 new IWorkspaceRunnable() {
 
3830                                                         public void run(IProgressMonitor progress) throws CoreException {
 
3831 //                                                              ISavedState savedState = workspace.addSaveParticipant(JavaCore.this, manager);
 
3832                                                                 ISavedState savedState = workspace.addSaveParticipant(plugin, manager);
 
3833                                                                 if (savedState != null) {
 
3834                                                                         // the event type coming from the saved state is always POST_AUTO_BUILD
 
3835                                                                         // force it to be POST_CHANGE so that the delta processor can handle it
 
3836                                                                         manager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
 
3837                                                                         savedState.processResourceChangeEvents(manager.deltaState);
 
3842                                 } catch (CoreException e) {
 
3843                                         return e.getStatus();
 
3845                                 return Status.OK_STATUS;
 
3848                 processSavedState.setSystem(true);
 
3849                 processSavedState.setPriority(Job.SHORT); // process asap
 
3850                 processSavedState.schedule();
 
3851         } catch (RuntimeException e) {
 
3857  * Shutdown the JavaCore plug-in.
 
3859  * De-registers the JavaModelManager as a resource changed listener and save participant.
 
3861  * @see org.eclipse.core.runtime.Plugin#stop(BundleContext)
 
3863 public static void stop(Plugin plugin, BundleContext context) throws Exception {
 
3865                 plugin.savePluginPreferences();
 
3866                 IWorkspace workspace = ResourcesPlugin.getWorkspace();
 
3867                 workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaState);
 
3868                 workspace.removeSaveParticipant(plugin);
 
3870                 JavaModelManager.getJavaModelManager().shutdown();
 
3872                 // ensure we call super.stop as the last thing
 
3873 //              super.stop(context);