platform/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourcesPlugin.java
author dadubrow
Tue, 02 Jun 2009 09:59:27 -0500
changeset 16 06d88bb6aac0
parent 12 063eb66097dc
permissions -rw-r--r--
Add refresh logging to core resources plugin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     1
/*******************************************************************************
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     3
 * All rights reserved. This program and the accompanying materials
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     4
 * are made available under the terms of the Eclipse Public License v1.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     5
 * which accompanies this distribution, and is available at
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     6
 * http://www.eclipse.org/legal/epl-v10.html
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     7
 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     8
 * Contributors:
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
     9
 *     IBM Corporation - initial API and implementation
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    10
 *******************************************************************************/
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    11
package org.eclipse.core.resources;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    12
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    13
import org.eclipse.core.internal.resources.*;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    14
import org.eclipse.core.internal.utils.Messages;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    15
import org.eclipse.core.runtime.*;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    16
import org.eclipse.core.runtime.jobs.IJobManager;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    17
import org.eclipse.core.runtime.jobs.Job;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    18
import org.osgi.framework.BundleActivator;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    19
import org.osgi.framework.BundleContext;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    20
16
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
    21
import java.util.logging.Level;
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
    22
12
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    23
/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    24
 * The plug-in runtime class for the Resources plug-in.  This is
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    25
 * the starting point for all workspace and resource manipulation.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    26
 * A typical sequence of events would be for a dependent plug-in
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    27
 * to call <code>ResourcesPlugin.getWorkspace()</code>.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    28
 * Doing so would cause this plug-in to be activated and the workspace
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    29
 * (if any) to be loaded from disk and initialized.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    30
 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    31
 * @noinstantiate This class is not intended to be instantiated by clients.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    32
 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    33
public final class ResourcesPlugin extends Plugin {
16
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
    34
12
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    35
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    36
	 * Unique identifier constant (value <code>"org.eclipse.core.resources"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    37
	 * for the standard Resources plug-in.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    38
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    39
	public static final String PI_RESOURCES = "org.eclipse.core.resources"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    40
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    41
	/*====================================================================
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    42
	 * Constants defining the ids of the standard workspace extension points:
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    43
	 *====================================================================*/
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    44
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    45
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    46
	 * Simple identifier constant (value <code>"builders"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    47
	 * for the builders extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    48
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    49
	public static final String PT_BUILDERS = "builders"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    50
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    51
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    52
	 * Simple identifier constant (value <code>"natures"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    53
	 * for the natures extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    54
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    55
	public static final String PT_NATURES = "natures"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    56
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    57
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    58
	 * Simple identifier constant (value <code>"markers"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    59
	 * for the markers extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    60
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    61
	public static final String PT_MARKERS = "markers"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    62
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    63
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    64
	 * Simple identifier constant (value <code>"fileModificationValidator"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    65
	 * for the file modification validator extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    66
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    67
	public static final String PT_FILE_MODIFICATION_VALIDATOR = "fileModificationValidator"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    68
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    69
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    70
	 * Simple identifier constant (value <code>"moveDeleteHook"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    71
	 * for the move/delete hook extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    72
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    73
	 * @since 2.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    74
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    75
	public static final String PT_MOVE_DELETE_HOOK = "moveDeleteHook"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    76
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    77
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    78
	 * Simple identifier constant (value <code>"teamHook"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    79
	 * for the team hook extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    80
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    81
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    82
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    83
	public static final String PT_TEAM_HOOK = "teamHook"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    84
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    85
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    86
	 * Simple identifier constant (value <code>"refreshProviders"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    87
	 * for the auto-refresh refresh providers extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    88
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    89
	 * @since 3.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    90
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    91
	public static final String PT_REFRESH_PROVIDERS = "refreshProviders"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    92
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    93
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    94
	 * Simple identifier constant (value <code>"modelProviders"</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    95
	 * for the model providers extension point.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    96
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    97
	 * @since 3.2
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    98
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
    99
	public static final String PT_MODEL_PROVIDERS = "modelProviders"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   100
	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   101
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   102
	 * Constant identifying the job family identifier for the background autobuild job.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   103
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   104
	 * @see IJobManager#join(Object, IProgressMonitor)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   105
	 * @since 3.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   106
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   107
	public static final Object FAMILY_AUTO_BUILD = new Object();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   108
	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   109
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   110
	 * Constant identifying the job family identifier for the background auto-refresh job.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   111
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   112
	 * @see IJobManager#join(Object, IProgressMonitor)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   113
	 * @since 3.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   114
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   115
	public static final Object FAMILY_AUTO_REFRESH = new Object();	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   116
	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   117
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   118
	 * Constant identifying the job family identifier for a background build job. All clients
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   119
	 * that schedule background jobs for performing builds should include this job
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   120
	 * family in their implementation of <code>belongsTo</code>.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   121
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   122
	 * @see IJobManager#join(Object, IProgressMonitor)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   123
	 * @see Job#belongsTo(Object)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   124
	 * @since 3.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   125
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   126
	public static final Object FAMILY_MANUAL_BUILD = new Object();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   127
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   128
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   129
	 * Constant identifying the job family identifier for a background refresh job. All clients
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   130
	 * that schedule background jobs for performing refreshing should include this job
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   131
	 * family in their implementation of <code>belongsTo</code>.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   132
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   133
	 * @see IJobManager#join(Object, IProgressMonitor)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   134
	 * @see Job#belongsTo(Object)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   135
	 * @since 3.4
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   136
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   137
	public static final Object FAMILY_MANUAL_REFRESH = new Object();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   138
	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   139
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   140
	 * Name of a preference indicating the encoding to use when reading text 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   141
	 * files in the workspace.  The value is a string, and may 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   142
	 * be the default empty string, indicating that the file system encoding should
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   143
	 * be used instead.  The file system encoding can be retrieved using
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   144
	 * <code>System.getProperty("file.encoding")</code>.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   145
	 * There is also a convenience method <code>getEncoding</code> which returns
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   146
	 * the value of this preference, or the file system encoding if this 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   147
	 * preference is not set.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   148
	 * <p>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   149
	 * Note that there is no guarantee that the value is a supported encoding.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   150
	 * Callers should be prepared to handle <code>UnsupportedEncodingException</code>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   151
	 * where this encoding is used.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   152
	 * </p>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   153
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   154
	 * @see #getEncoding()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   155
	 * @see java.io.UnsupportedEncodingException
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   156
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   157
	public static final String PREF_ENCODING = "encoding"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   158
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   159
	/** 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   160
	 * Common prefix for workspace preference names.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   161
	 * @since 2.1 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   162
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   163
	private static final String PREF_DESCRIPTION_PREFIX = "description."; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   164
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   165
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   166
	 * @deprecated Do not use.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   167
	 * @since 3.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   168
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   169
	public static final String PREF_MAX_NOTIFICATION_DELAY = "maxnotifydelay"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   170
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   171
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   172
	 * Name of a preference for configuring whether the workspace performs auto-
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   173
	 * builds.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   174
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   175
	 * @see IWorkspaceDescription#isAutoBuilding()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   176
	 * @see IWorkspaceDescription#setAutoBuilding(boolean)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   177
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   178
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   179
	public static final String PREF_AUTO_BUILDING = PREF_DESCRIPTION_PREFIX + "autobuilding"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   180
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   181
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   182
	 * Name of a preference for configuring the order projects in the workspace
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   183
	 * are built.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   184
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   185
	 * @see IWorkspaceDescription#getBuildOrder()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   186
	 * @see IWorkspaceDescription#setBuildOrder(String[])
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   187
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   188
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   189
	public static final String PREF_BUILD_ORDER = PREF_DESCRIPTION_PREFIX + "buildorder"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   190
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   191
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   192
	 * Name of a preference for configuring whether to use the workspace's
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   193
	 * default order for building projects.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   194
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   195
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   196
	public static final String PREF_DEFAULT_BUILD_ORDER = PREF_DESCRIPTION_PREFIX + "defaultbuildorder"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   197
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   198
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   199
	 * Name of a preference for configuring the maximum number of times that the
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   200
	 * workspace should rebuild when builders affect projects that have already
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   201
	 * been built.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   202
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   203
	 * @see IWorkspaceDescription#getMaxBuildIterations()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   204
	 * @see IWorkspaceDescription#setMaxBuildIterations(int)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   205
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   206
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   207
	public static final String PREF_MAX_BUILD_ITERATIONS = PREF_DESCRIPTION_PREFIX + "maxbuilditerations"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   208
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   209
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   210
	 * Name of a preference for configuring the maximum number of milliseconds a
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   211
	 * file state should be kept in the local history
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   212
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   213
	 * @see IWorkspaceDescription#getFileStateLongevity()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   214
	 * @see IWorkspaceDescription#setFileStateLongevity(long)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   215
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   216
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   217
	public static final String PREF_FILE_STATE_LONGEVITY = PREF_DESCRIPTION_PREFIX + "filestatelongevity"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   218
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   219
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   220
	 * Name of a preference for configuring the maximum permitted size of a file
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   221
	 * to be stored in the local history
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   222
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   223
	 * @see IWorkspaceDescription#getMaxFileStateSize()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   224
	 * @see IWorkspaceDescription#setMaxFileStateSize(long)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   225
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   226
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   227
	public static final String PREF_MAX_FILE_STATE_SIZE = PREF_DESCRIPTION_PREFIX + "maxfilestatesize"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   228
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   229
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   230
	 * Name of a preference for configuring the maximum number of states per
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   231
	 * file that can be stored in the local history.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   232
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   233
	 * @see IWorkspaceDescription#getMaxFileStates()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   234
	 * @see IWorkspaceDescription#setMaxFileStates(int)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   235
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   236
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   237
	public static final String PREF_MAX_FILE_STATES = PREF_DESCRIPTION_PREFIX + "maxfilestates"; //$NON-NLS-1$	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   238
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   239
	 * Name of a preference for configuring the amount of time in milliseconds
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   240
	 * between automatic workspace snapshots
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   241
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   242
	 * @see IWorkspaceDescription#getSnapshotInterval()
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   243
	 * @see IWorkspaceDescription#setSnapshotInterval(long)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   244
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   245
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   246
	public static final String PREF_SNAPSHOT_INTERVAL = PREF_DESCRIPTION_PREFIX + "snapshotinterval"; //$NON-NLS-1$	
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   247
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   248
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   249
	 * Name of a preference for turning off support for linked resources.  When
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   250
	 * this preference is set to "true", attempting to create linked resources will fail.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   251
	 * @since 2.1
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   252
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   253
	public static final String PREF_DISABLE_LINKING = PREF_DESCRIPTION_PREFIX + "disableLinking";//$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   254
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   255
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   256
	 * Name of a preference for configuring whether the workspace performs auto-
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   257
	 * refresh.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   258
	 * @since 3.0
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   259
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   260
	public static final String PREF_AUTO_REFRESH = "refresh.enabled"; //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   261
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   262
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   263
	 * The single instance of this plug-in runtime class.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   264
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   265
	private static ResourcesPlugin plugin;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   266
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   267
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   268
	 * The workspace managed by the single instance of this
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   269
	 * plug-in runtime class, or <code>null</code> is there is none.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   270
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   271
	private static Workspace workspace = null;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   272
16
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   273
	
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   274
	private static final String REFRESH_LOG_ID = ".refresh.log";
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   275
	private DiagnosticLog refreshLog;
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   276
	
12
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   277
	/** 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   278
	 * Constructs an instance of this plug-in runtime class.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   279
	 * <p>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   280
	 * An instance of this plug-in runtime class is automatically created 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   281
	 * when the facilities provided by the Resources plug-in are required.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   282
	 * <b>Clients must never explicitly instantiate a plug-in runtime class.</b>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   283
	 * </p>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   284
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   285
	public ResourcesPlugin() {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   286
		plugin = this;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   287
	}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   288
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   289
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   290
	 * Constructs a brand new workspace structure at the location in the local file system
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   291
	 * identified by the given path and returns a new workspace object.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   292
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   293
	 * @exception CoreException if the workspace structure could not be constructed.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   294
	 * Reasons include:
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   295
	 * <ul>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   296
	 * <li> There is an existing workspace structure on at the given location
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   297
	 *      in the local file system.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   298
	 * <li> A file exists at the given location in the local file system.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   299
	 * <li> A directory could not be created at the given location in the
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   300
	 *      local file system.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   301
	 * </ul>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   302
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   303
	private static void constructWorkspace() throws CoreException {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   304
		new LocalMetaArea().createMetaArea();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   305
	}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   306
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   307
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   308
	 * Returns the encoding to use when reading text files in the workspace.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   309
	 * This is the value of the <code>PREF_ENCODING</code> preference, or the
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   310
	 * file system encoding (<code>System.getProperty("file.encoding")</code>)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   311
	 * if the preference is not set.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   312
	 * <p>
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   313
	 * Note that this method does not check whether the result is a supported
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   314
	 * encoding.  Callers should be prepared to handle 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   315
	 * <code>UnsupportedEncodingException</code> where this encoding is used.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   316
	 * 
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   317
	 * @return  the encoding to use when reading text files in the workspace
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   318
	 * @see java.io.UnsupportedEncodingException
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   319
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   320
	public static String getEncoding() {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   321
		String enc = getPlugin().getPluginPreferences().getString(PREF_ENCODING);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   322
		if (enc == null || enc.length() == 0) {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   323
			enc = System.getProperty("file.encoding"); //$NON-NLS-1$
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   324
		}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   325
		return enc;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   326
	}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   327
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   328
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   329
	 * Returns the Resources plug-in.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   330
	 *
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   331
	 * @return the single instance of this plug-in runtime class
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   332
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   333
	public static ResourcesPlugin getPlugin() {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   334
		return plugin;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   335
	}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   336
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   337
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   338
	 * Returns the workspace. The workspace is not accessible after the resources
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   339
	 * plug-in has shutdown.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   340
	 *
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   341
	 * @return the workspace that was created by the single instance of this
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   342
	 *   plug-in class.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   343
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   344
	public static IWorkspace getWorkspace() {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   345
		if (workspace == null)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   346
			throw new IllegalStateException(Messages.resources_workspaceClosed);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   347
		return workspace;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   348
	}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   349
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   350
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   351
	 * This implementation of the corresponding {@link BundleActivator} method
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   352
	 * closes the workspace without saving.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   353
	 * @see BundleActivator#stop(BundleContext)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   354
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   355
	public void stop(BundleContext context) throws Exception {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   356
		super.stop(context);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   357
		if (workspace == null)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   358
			return;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   359
		// save the preferences for this plug-in
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   360
		getPlugin().savePluginPreferences();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   361
		workspace.close(null);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   362
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   363
		// Forget workspace only if successfully closed, to
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   364
		// make it easier to debug cases where close() is failing.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   365
		workspace = null;
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   366
	}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   367
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   368
	/**
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   369
	 * This implementation of the corresponding {@link BundleActivator} method
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   370
	 * opens the workspace.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   371
	 * @see BundleActivator#start(BundleContext)
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   372
	 */
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   373
	public void start(BundleContext context) throws Exception {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   374
		super.start(context);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   375
		if (!new LocalMetaArea().hasSavedWorkspace()) {
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   376
			constructWorkspace();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   377
		}
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   378
		Workspace.DEBUG = ResourcesPlugin.getPlugin().isDebugging();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   379
		// Remember workspace before opening, to
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   380
		// make it easier to debug cases where open() is failing.
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   381
		workspace = new Workspace();
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   382
		PlatformURLResourceConnection.startup(workspace.getRoot().getLocation());
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   383
		IStatus result = workspace.open(null);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   384
		if (!result.isOK())
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   385
			getLog().log(result);
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   386
	}
16
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   387
	
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   388
	public static void writeRefreshLog(String s) {
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   389
		if (!plugin.getPluginPreferences().getBoolean(PI_RESOURCES + REFRESH_LOG_ID))
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   390
			return;
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   391
		
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   392
		if (plugin.refreshLog == null) {
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   393
			IPath path = getWorkspace().getRoot().getLocation().append("refresh.log");
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   394
			plugin.refreshLog = new DiagnosticLog("refresh.log", PI_RESOURCES + REFRESH_LOG_ID, path.toOSString());
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   395
			plugin.refreshLog.getLogger().setLevel(Level.INFO);
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   396
		}
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   397
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   398
		plugin.refreshLog.getLogger().info(s);
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   399
		System.out.println(s);
06d88bb6aac0 Add refresh logging to core resources plugin
dadubrow
parents: 12
diff changeset
   400
	}
12
063eb66097dc Added build of org.eclipse.core.resources
Steve Sobek <steve.sobek@nokia.com>
parents:
diff changeset
   401
}