--- a/platform35/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java Thu Jul 30 11:56:23 2009 -0500
+++ b/platform35/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java Thu Jul 30 12:03:02 2009 -0500
@@ -15,6 +15,7 @@
import java.net.URI;
import java.util.*;
import org.eclipse.core.filesystem.*;
+import org.eclipse.core.internal.refresh.RefreshJob;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.internal.resources.*;
import org.eclipse.core.internal.resources.File;
@@ -756,6 +757,26 @@
}
public boolean refresh(IResource target, int depth, boolean updateAliases, IProgressMonitor monitor) throws CoreException {
+ long startTimeMs = System.currentTimeMillis();
+ boolean result = refreshImpl(target, depth, updateAliases, monitor);
+ if (!RefreshJob.isRefreshing()) {
+ long totalMs = System.currentTimeMillis() - startTimeMs;
+ StringBuffer sb = new StringBuffer();
+ sb.append("Refresh called on ");
+ sb.append(target.getFullPath());
+ sb.append(" completed in : ");
+ sb.append(totalMs);
+ sb.append("ms");
+ ResourcesPlugin.writeRefreshLog(sb.toString());
+ StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+ for (int i = 2; i < trace.length; i++) { // skip the getStackTrace and dump calls
+ ResourcesPlugin.writeRefreshLog("\tat " + trace[i]);
+ }
+ }
+ return result;
+ }
+
+ private boolean refreshImpl(IResource target, int depth, boolean updateAliases, IProgressMonitor monitor) throws CoreException {
switch (target.getType()) {
case IResource.ROOT :
return refreshRoot((IWorkspaceRoot) target, depth, updateAliases, monitor);
@@ -812,7 +833,7 @@
// drop the depth by one level since processing the root counts as one level.
depth = depth == IResource.DEPTH_ONE ? IResource.DEPTH_ZERO : depth;
for (int i = 0; i < projects.length; i++)
- changed |= refresh(projects[i], depth, updateAliases, Policy.subMonitorFor(monitor, 1));
+ changed |= refreshImpl(projects[i], depth, updateAliases, Policy.subMonitorFor(monitor, 1));
return changed;
} finally {
monitor.done();
--- a/platform35/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/RefreshJob.java Thu Jul 30 11:56:23 2009 -0500
+++ b/platform35/org.eclipse.core.resources/src/org/eclipse/core/internal/refresh/RefreshJob.java Thu Jul 30 12:03:02 2009 -0500
@@ -11,6 +11,7 @@
package org.eclipse.core.internal.refresh;
import java.util.*;
+
import org.eclipse.core.internal.localstore.PrefixPool;
import org.eclipse.core.internal.utils.Messages;
import org.eclipse.core.internal.utils.Policy;
@@ -27,6 +28,13 @@
*/
public class RefreshJob extends WorkspaceJob {
private static final long UPDATE_DELAY = 200;
+
+ /**
+ * Flag indicating refreshing in progress if > 0
+ */
+ private static int refreshingLevel = 0;
+
+
/**
* List of refresh requests. Requests are processed in order from
* the end of the list. Requests can be added to either the beginning
@@ -151,6 +159,13 @@
MultiStatus errors = new MultiStatus(ResourcesPlugin.PI_RESOURCES, 1, msg, null);
long longestRefresh = 0;
try {
+ refreshingLevel++;
+ ResourcesPlugin.writeRefreshLog(RefreshManager.DEBUG_PREFIX + " refreshing started..."); //$NON-NLS-1$
+ for (Iterator iterator = fRequests.iterator(); iterator.hasNext();) {
+ IResource resource = (IResource) iterator.next();
+ ResourcesPlugin.writeRefreshLog(RefreshManager.DEBUG_PREFIX + " requested resource to refresh: " + resource.getFullPath()); //$NON-NLS-1$
+ }
+
if (RefreshManager.DEBUG)
Policy.debug(RefreshManager.DEBUG_PREFIX + " starting refresh job"); //$NON-NLS-1$
int refreshCount = 0;
@@ -193,6 +208,9 @@
monitor.done();
if (RefreshManager.DEBUG)
System.out.println(RefreshManager.DEBUG_PREFIX + " finished refresh job in: " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ResourcesPlugin.writeRefreshLog(RefreshManager.DEBUG_PREFIX + " finished refresh job in: " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ refreshingLevel--;
}
if (!errors.isOK())
return errors;
@@ -222,4 +240,8 @@
System.out.println(RefreshManager.DEBUG_PREFIX + " disabling auto-refresh"); //$NON-NLS-1$
cancel();
}
+
+ public static boolean isRefreshing() {
+ return refreshingLevel > 0;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/platform35/org.eclipse.core.resources/src/org/eclipse/core/internal/utils/messages.properties Thu Jul 30 12:03:02 2009 -0500
@@ -0,0 +1,291 @@
+###############################################################################
+# Copyright (c) 2000, 2008 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+### Resources plugin messages.
+
+### dtree
+dtree_immutable = Illegal attempt to modify an immutable tree.
+dtree_malformedTree = Malformed tree.
+dtree_missingChild = Missing child node: {0}.
+dtree_notFound = Tree element ''{0}'' not found.
+dtree_notImmutable = Tree must be immutable.
+dtree_reverse = Tried to reverse a non-comparison tree.
+dtree_subclassImplement = Subclass should have implemented this.
+dtree_switchError = Switch error in DeltaTreeReader.readNode().
+
+### events
+events_builderError = Errors running builder ''{0}'' on project ''{1}''.
+events_building_0 = Building workspace
+events_building_1 = Building ''{0}''
+events_errors = Errors during build.
+events_instantiate_1 = Error instantiating builder ''{0}''.
+events_invoking_1 = Invoking builder on ''{0}''.
+events_invoking_2 = Invoking ''{0}'' on ''{1}''.
+events_skippingBuilder = Skipping builder ''{0}'' for project ''{1}''. Either the builder is missing from the install, or it belongs to a project nature that is missing or disabled.
+events_unknown = {0} encountered while running {1}.
+
+history_copyToNull = Unable to copy local history to or from a null location.
+history_copyToSelf = Unable to copy local history to and from the same location.
+history_errorContentDescription = Error retrieving content description for local history for: ''{0}''.
+history_notValid = State is not valid or might have expired.
+history_problemsCleaning = Problems cleaning up history store.
+
+links_creating = Creating link.
+links_errorLinkReconcile = Error processing changed links in project description file.
+links_invalidLocation = ''{0}'' is not a valid location for linked resources.
+links_localDoesNotExist = Cannot create linked resource. Local location ''{0}'' does not exist.
+links_locationOverlapsLink = ''{0}'' is not a valid location because the project contains a linked resource at that location.
+links_locationOverlapsProject = Cannot create a link to ''{0}'' because it overlaps the location of the project that contains the linked resource.
+links_natureVeto = Linking is not allowed because project nature ''{0}'' does not allow it.
+links_noPath = A Link location must be specified.
+links_overlappingResource = Location ''{0}'' may overlap another resource. This can cause unexpected side-effects.
+links_updatingDuplicate = Updating duplicate resource: ''{0}''.
+links_parentNotAccessible = Cannot create linked resource ''{0}''. The parent resource is not accessible.
+links_notFileFolder = Cannot create linked resource ''{0}''. Only files and folders can be linked.
+links_vetoNature = Cannot add nature because project ''{0}'' contains linked resources, and nature ''{1}'' does not allow it.
+links_workspaceVeto = Linked resources are not supported by this application.
+links_wrongLocalType = Cannot create linked resource ''{0}''. Files cannot be linked to folders.
+
+### local store
+localstore_copying = Copying ''{0}''.
+localstore_copyProblem = Problems encountered while copying resources.
+localstore_couldnotDelete = Could not delete ''{0}''.
+localstore_couldNotMove = Could not move ''{0}''.
+localstore_couldNotRead = Could not read file ''{0}''.
+localstore_couldNotWrite = Could not write file ''{0}''.
+localstore_couldNotWriteReadOnly = Could not write to read-only file: ''{0}''.
+localstore_deleteProblem = Problems encountered while deleting resources.
+localstore_deleting = Deleting ''{0}''.
+localstore_failedReadDuringWrite = Could not read from source when writing file ''{0}''
+localstore_fileExists = A resource already exists on disk ''{0}''.
+localstore_fileNotFound = File not found: {0}.
+localstore_locationUndefined = The location for ''{0}'' could not be determined because it is based on an undefined path variable.
+localstore_refreshing = Refreshing ''{0}''.
+localstore_refreshingRoot = Refreshing workspace.
+localstore_resourceExists = Resource already exists on disk: ''{0}''.
+localstore_resourceIsOutOfSync = Resource is out of sync with the file system: ''{0}''.
+
+### Resource mappings and models
+mapping_invalidDef = Model provider extension found with invalid definition: {0}.
+mapping_wrongType = Model provider ''{0}'' does not extend ModelProvider.
+mapping_noIdentifier = Found model provider extension with no identifier; ignoring extension.
+mapping_validate = Validating resource changes
+mapping_multiProblems = Multiple potential side effects have been identified.
+
+### internal.resources
+natures_duplicateNature = Duplicate nature: {0}.
+natures_hasCycle = Nature is invalid because its prerequisites form a cycle: {0}
+natures_missingIdentifier = Found nature extension with no identifier; ignoring extension.
+natures_missingNature = Nature does not exist: {0}.
+natures_missingPrerequisite = Nature {0} is missing prerequisite nature: {1}.
+natures_multipleSetMembers = Multiple natures found for nature set: {0}.
+natures_invalidDefinition = Nature extension found with invalid definition: {0}.
+natures_invalidRemoval = Cannot remove nature {0} because it is a prerequisite of nature {1}.
+natures_invalidSet = The set of natures is not valid.
+
+pathvar_length = Path variable name must have a length > 0.
+pathvar_beginLetter = Path variable name must begin with a letter or underscore.
+pathvar_invalidChar = Path variable name cannot contain character: {0}.
+pathvar_invalidValue = Path variable value must be valid and absolute.
+pathvar_undefined = ''{0}'' is not a valid location. The location is relative to undefined workspace path variable ''{1}''.
+pathvar_whitespace= Path variable name cannot contain whitespace
+
+### preferences
+preferences_deleteException=Exception deleting file: {0}.
+preferences_loadException=Exception loading preferences from: {0}.
+preferences_operationCanceled=Operation canceled.
+preferences_removeNodeException=Exception while removing preference node: {0}.
+preferences_clearNodeException=Exception while clearing preference node: {0}.
+preferences_saveProblems=Exception occurred while saving project preferences: {0}.
+preferences_syncException=Exception occurred while synchronizing node: {0}.
+
+projRead_badLinkName = Names ''{0}'' and ''{1}'' detected for a single link. Using ''{0}''.
+projRead_badLinkType2 = Types ''{0}'' and ''{1}'' detected for a single link. Using ''{0}''.
+projRead_badLocation = Locations ''{0}'' and ''{1}'' detected for a single link. Using ''{0}''.
+projRead_emptyLinkName = Empty name detected for linked resource with type ''{0}'' and location ''{1}''.
+projRead_badLinkType = Illegal link type \"-1\" detected for linked resource with name ''{0}'' and location ''{1}''.
+projRead_badLinkLocation = Empty location detected for linked resource with name ''{0}'' and type ''{1}''.
+projRead_whichKey = Two values detected for an argument name in a build command: ''{0}'' and ''{1}''. Using ''{0}''.
+projRead_whichValue = Two values detected for an argument value in a build command: ''{0}'' and ''{1}''. Using ''{0}''.
+projRead_notProjectDescription = Encountered element name ''{0}'' instead of \"project\" when trying to read a project description file.
+projRead_failureReadingProjectDesc = Failure occurred reading .project file.
+
+properties_qualifierIsNull = Qualifier part of property key cannot be null.
+properties_readProperties = Failure while reading persistent properties for resource ''{0}'', file was corrupt. Some properties may have been lost.
+properties_valueTooLong = Could not set property: {0} {1}. Value is too long.
+properties_couldNotClose = Could not close property store for: {0}.
+
+### auto-refresh
+refresh_jobName = Refreshing workspace
+refresh_task = Resources to refresh: {0}
+refresh_pollJob = Searching for local changes
+refresh_refreshErr = Problems occurred while refreshing local changes
+refresh_installError = An error occurred while installing an auto-refresh monitor
+
+resources_cannotModify = The resource tree is locked for modifications.
+resources_changeInAdd = Trying to change a marker in an add method.
+resources_charsetBroadcasting = Reporting encoding changes.
+resources_charsetUpdating = Updating encoding settings.
+resources_closing_0 = Closing workspace.
+resources_closing_1 = Closing ''{0}''.
+resources_copyDestNotSub = Cannot copy ''{0}''. Destination should not be under source''s hierarchy.
+resources_copying = Copying ''{0}''.
+resources_copying_0 = Copying.
+resources_copyNotMet = Copy requirements not met.
+resources_copyProblem = Problems encountered while copying resources.
+resources_couldnotDelete = Could not delete ''{0}''.
+resources_create = Create.
+resources_creating = Creating resource ''{0}''.
+resources_deleteMeta = Could not delete metadata for ''{0}''.
+resources_deleteProblem = Problems encountered while deleting resources.
+resources_deleting = Deleting ''{0}''.
+resources_deleting_0 = Deleting.
+resources_destNotNull = Destination path should not be null.
+resources_errorContentDescription = Error retrieving content description for resource ''{0}''.
+resources_errorDeleting = Error deleting resource ''{0}'' from the workspace tree.
+resources_errorMarkersDelete = Error deleting markers for resource ''{0}''.
+resources_errorMarkersMove = Error moving markers from resource ''{0}'' to ''{1}''.
+resources_errorMembers = Error retrieving members of container ''{0}''.
+resources_errorMoving = Error moving resource ''{0}'' to ''{1}'' in the workspace tree.
+resources_errorNature = Error configuring nature ''{0}''.
+resources_errorPropertiesMove = Error moving properties for resource ''{0}'' to ''{1}''.
+resources_errorRefresh = Errors occurred during refresh of resource ''{0}''.
+resources_errorReadProject = Failed to read project description file from location ''{0}''.
+resources_errorMultiRefresh = Errors occurred while refreshing resources with the local file system.
+resources_errorValidator = Exception running validator code.
+resources_errorVisiting = An error occurred while traversing resources.
+resources_existsDifferentCase = A resource exists with a different case: ''{0}''.
+resources_existsLocalDifferentCase = A resource exists on disk with a different case: ''{0}''.
+resources_exMasterTable = Could not read master table.
+resources_exReadProjectLocation = Could not read the project location for ''{0}''.
+resources_exSafeRead = Could not read safe table.
+resources_exSafeSave = Could not save safe table.
+resources_exSaveMaster = Could not save master table.
+resources_exSaveProjectLocation = Could not save the project location for ''{0}''.
+resources_fileExists = A resource already exists on disk ''{0}''.
+resources_fileToProj = Cannot copy a file to a project.
+resources_flushingContentDescriptionCache = Flushing content description cache.
+resources_folderOverFile = Cannot overwrite folder with file ''{0}''.
+resources_format = Incompatible file format. Workspace was saved with an incompatible version: {0}.
+resources_initValidator = Unable to instantiate validator.
+resources_initHook = Unable to instantiate move/delete hook.
+resources_initTeamHook = Unable to instantiate team hook.
+resources_invalidCharInName = {0} is an invalid character in resource name ''{1}''.
+resources_invalidCharInPath = {0} is an invalid character in path ''{1}''.
+resources_invalidName = ''{0}'' is an invalid name on this platform.
+resources_invalidPath = ''{0}'' is an invalid resource path.
+resources_invalidProjDesc = Invalid project description.
+resources_invalidResourceName = ''{0}'' is an invalid resource name.
+resources_invalidRoot = Root (/) is an invalid resource path.
+resources_markerNotFound = Marker id {0} not found.
+resources_missingProjectMeta = The project description file (.project) for ''{0}'' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
+resources_missingProjectMetaRepaired = The project description file (.project) for ''{0}'' was missing. This file contains important information about the project. A new project description file has been created, but some information about the project may have been lost.
+resources_moveDestNotSub = Cannot move ''{0}''. Destination should not be under source''s hierarchy.
+resources_moveMeta = Error moving metadata area from {0} to {1}.
+resources_moveNotMet = Move requirements not met.
+resources_moveNotProject = Cannot move ''{0}'' to ''{1}''. Source must be a project.
+resources_moveProblem = Problems encountered while moving resources.
+resources_moveRoot = Cannot move the workspace root.
+resources_moving = Moving ''{0}''.
+resources_moving_0 = Moving.
+resources_mustBeAbsolute = Path ''{0}'' must be absolute.
+resources_mustBeLocal = Resource ''{0}'' is not local.
+resources_mustBeOpen = Resource ''{0}'' is not open.
+resources_mustExist = Resource ''{0}'' does not exist.
+resources_mustNotExist = Resource ''{0}'' already exists.
+resources_nameEmpty = Names cannot be empty.
+resources_nameNull = Name must not be null.
+resources_natureClass = Missing project nature class for ''{0}''.
+resources_natureDeconfig = Error deconfiguring nature: {0}.
+resources_natureExtension = Missing project nature extension for {0}.
+resources_natureFormat = Project nature {0} does not specify a runtime attribute.
+resources_natureImplement = Project nature {0} does not implement IProjectNature.
+resources_notChild = Resource ''{0}'' is not a child of ''{1}''.
+resources_oneValidator = There must be exactly 0 or 1 validator extensions defined in the fileModificationValidator extension point.
+resources_oneHook = There must be exactly 0 or 1 hook extensions defined in the moveDeleteHook extension point.
+resources_oneTeamHook = There must be exactly 0 or 1 hook extensions defined in the teamHook extension point.
+resources_opening_1 = Opening ''{0}''.
+resources_overlapWorkspace = {0} overlaps the workspace location: {1}
+resources_overlapProject = {0} overlaps the location of another project: ''{1}''
+resources_pathNull = Paths must not be null.
+resources_projectDesc = Problems encountered while setting project description.
+resources_projectDescSync = Could not set the project description for ''{0}'' because the project description file (.project) is out of sync with the file system.
+resources_projectPath = Path for project must have only one segment.
+resources_reading = Reading.
+resources_readingSnap = Reading snapshot.
+resources_readingEncoding = Could not read encoding settings.
+resources_readMarkers = Failure while reading markers, the marker file was corrupt. Some markers may be lost.
+resources_readMeta = Could not read metadata for ''{0}''.
+resources_readMetaWrongVersion = Could not read metadata for ''{0}''. Unexpected version: {1}.
+resources_readOnly = Resource ''{0}'' is read-only.
+resources_readOnly2 = Cannot edit read-only resources.
+resources_readProjectMeta = Failed to read the project description file (.project) for ''{0}''. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.
+resources_readProjectTree = Problems reading project tree.
+resources_readSync = Errors reading sync info file: {0}.
+resources_readWorkspaceMeta = Could not read workspace metadata.
+resources_readWorkspaceMetaValue = Invalid attribute value in workspace metadata: {0}. Value will be ignored.
+resources_readWorkspaceSnap = Problems reading workspace tree snapshot.
+resources_readWorkspaceTree = Problems reading workspace tree.
+resources_refreshing = Refreshing ''{0}''.
+resources_refreshingRoot = Refreshing workspace.
+resources_resetMarkers = Could not reset markers snapshot file.
+resources_resetSync = Could not reset sync info snapshot file.
+resources_resourcePath = Invalid path for resource ''{0}''. Must include project and resource name.
+resources_saveOp = Save cannot be called from inside an operation.
+resources_saveProblem = Problems occurred during save.
+resources_saveWarnings = Save operation warnings.
+resources_saving_0 = Saving workspace.
+resources_savingEncoding = Could not save encoding settings.
+resources_setDesc = Setting project description.
+resources_setLocal = Setting resource local flag.
+resources_settingCharset = Setting character set for resource ''{0}''.
+resources_settingDefaultCharsetContainer = Setting default character set for resource ''{0}''.
+resources_settingContents = Setting contents for ''{0}''.
+resources_shutdown = Workspace was not properly initialized or has already shutdown.
+resources_shutdownProblems = Problem on shutdown.
+resources_snapInit = Could not initialize snapshot file.
+resources_snapRead = Could not read snapshot file.
+resources_snapRequest = Snapshot requested.
+resources_snapshot = Periodic workspace save.
+resources_startupProblems = Workspace restored, but some problems occurred.
+resources_touch = Touching resource ''{0}''.
+resources_updating = Updating workspace
+resources_updatingEncoding = Problems encountered while updating encoding settings.
+resources_workspaceClosed = Workspace is closed.
+resources_workspaceOpen = The workspace is already open.
+resources_writeMeta = Could not write metadata for ''{0}''.
+resources_writeWorkspaceMeta = Could not write workspace metadata ''{0}''.
+
+synchronizer_partnerNotRegistered = Sync partner: {0} not registered with the synchronizer.
+
+### URL
+url_badVariant = Unsupported \"platform:\" protocol variation {0}.
+url_couldNotResolve = Project ''{0}'' does not exist. Could not resolve URL: {1}.
+
+### utils
+utils_clone = Clone not supported.
+utils_stringJobName = Compacting memory
+
+### watson
+watson_elementNotFound = Element not found: {0}.
+watson_illegalSubtree = Illegal subtree passed to createSubtree().
+watson_immutable = Attempt to modify an immutable tree.
+watson_noModify = Cannot modify implicit root node.
+watson_nullArg = Null argument to {0}.
+watson_unknown = Unknown format.
+
+### auto-refresh win32 native
+WM_beginTask = finding out of sync resources
+WM_jobName = Win32 refresh daemon
+WM_errors = Problems occurred refreshing resources
+WM_nativeErr = Problem occurred in auto-refresh native code: {0}.
+WM_errCloseHandle = Problem closing native refresh handle: {0}.
+WM_errCreateHandle = Problem creating handle for {0}, code: {0}.
+WM_errFindChange = Problem finding next change, code: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/platform35/org.eclipse.core.resources/src/org/eclipse/core/resources/DiagnosticLog.java Thu Jul 30 12:03:02 2009 -0500
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package org.eclipse.core.resources;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+public class DiagnosticLog {
+ private String name;
+ private String id;
+ private Logger logger;
+ private File file;
+
+ private class LogHandler extends Handler {
+
+ FileHandler fileHandler;
+ File file;
+
+ public LogHandler(File file) {
+ this.file = file;
+ }
+
+ public void close() throws SecurityException {
+ if (fileHandler != null)
+ fileHandler.close();
+ }
+
+ public void flush() {
+ if (fileHandler != null)
+ fileHandler.flush();
+ }
+
+ public void publish(LogRecord record) {
+ if (fileHandler == null)
+ {
+ try {
+ fileHandler= new FileHandler(file.getAbsolutePath());
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (fileHandler != null)
+ fileHandler.publish(record);
+ }
+
+ }
+
+ public DiagnosticLog(String name, String id, String logFilePath) {
+ this.name = name;
+ this.id = id;
+ this.logger = Logger.getLogger(id);
+ logger.setLevel(Level.OFF);
+ logger.setUseParentHandlers(false);
+ this.file = new File(logFilePath);
+ logger.addHandler(new LogHandler(file));
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public Logger getLogger() {
+ return logger;
+ }
+
+}
\ No newline at end of file
--- a/platform35/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourcesPlugin.java Thu Jul 30 11:56:23 2009 -0500
+++ b/platform35/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourcesPlugin.java Thu Jul 30 12:03:02 2009 -0500
@@ -17,6 +17,8 @@
import org.eclipse.core.runtime.jobs.Job;
import org.osgi.framework.*;
+import java.util.logging.Level;
+
/**
* The plug-in runtime class for the Resources plug-in. This is
* the starting point for all workspace and resource manipulation.
@@ -28,6 +30,7 @@
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class ResourcesPlugin extends Plugin {
+
/**
* Unique identifier constant (value <code>"org.eclipse.core.resources"</code>)
* for the standard Resources plug-in.
@@ -152,6 +155,10 @@
*/
public static final String PREF_ENCODING = "encoding"; //$NON-NLS-1$
+
+ private static final String REFRESH_LOG_ID = ".refresh.log";
+ private DiagnosticLog refreshLog;
+
/**
* Common prefix for workspace preference names.
* @since 2.1
@@ -279,6 +286,20 @@
public ResourcesPlugin() {
plugin = this;
}
+
+ public static void writeRefreshLog(String s) {
+ if (!plugin.getPluginPreferences().getBoolean(PI_RESOURCES + REFRESH_LOG_ID))
+ return;
+
+ if (plugin.refreshLog == null) {
+ IPath path = getWorkspace().getRoot().getLocation().append("refresh.log");
+ plugin.refreshLog = new DiagnosticLog("refresh.log", PI_RESOURCES + REFRESH_LOG_ID, path.toOSString());
+ plugin.refreshLog.getLogger().setLevel(Level.INFO);
+ }
+
+ plugin.refreshLog.getLogger().info(s);
+ System.out.println(s);
+ }
/**
* Constructs a brand new workspace structure at the location in the local file system