View | Details | Raw Unified | Return to bug 301563 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/internal/resources/LocalMetaArea.java (-2 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-13 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 * Francis Lynch (Wind River) - [301563] Save and load tree snapshots
11
 *******************************************************************************/
10
 *******************************************************************************/
12
package org.eclipse.core.internal.resources;
11
package org.eclipse.core.internal.resources;
13
12
(-)src/org/eclipse/core/internal/resources/Project.java (-4 / +4 lines)
Lines 9-15 Link Here
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Serge Beauchamp (Freescale Semiconductor) - [229633] Project Path Variable Support
10
 *     Serge Beauchamp (Freescale Semiconductor) - [229633] Project Path Variable Support
11
 * Anton Leherbauer (Wind River) - [198591] Allow Builder to specify scheduling rule
11
 * Anton Leherbauer (Wind River) - [198591] Allow Builder to specify scheduling rule
12
 * Francis Lynch (Wind River) - [301563] Save and load tree snapshots
12
 * Francis Lynch (Wind River) - [301563] Save and load refresh information snapshots
13
 *******************************************************************************/
13
 *******************************************************************************/
14
package org.eclipse.core.internal.resources;
14
package org.eclipse.core.internal.resources;
15
15
Lines 837-843 Link Here
837
			// copy the snapshot from the URI into the project metadata
837
			// copy the snapshot from the URI into the project metadata
838
			IPath snapshotPath = workspace.getMetaArea().getRefreshLocationFor(this);
838
			IPath snapshotPath = workspace.getMetaArea().getRefreshLocationFor(this);
839
			IFileStore snapshotFileStore = EFS.getStore(org.eclipse.core.filesystem.URIUtil.toURI(snapshotPath));
839
			IFileStore snapshotFileStore = EFS.getStore(org.eclipse.core.filesystem.URIUtil.toURI(snapshotPath));
840
			EFS.getStore(snapshotLocation).copy(snapshotFileStore, EFS.OVERWRITE, monitor);
840
			snapshotFileStore.delete(EFS.NONE, monitor);
841
			EFS.getStore(snapshotLocation).copy(snapshotFileStore, options, monitor);
841
		}
842
		}
842
	}
843
	}
843
	/* (non-Javadoc)
844
	/* (non-Javadoc)
Lines 1083-1089 Link Here
1083
							this, snapshotLocation, sub);
1084
							this, snapshotLocation, sub);
1084
					monitor.worked(Policy.opWork / 2);
1085
					monitor.worked(Policy.opWork / 2);
1085
				} catch (OperationCanceledException e) {
1086
				} catch (OperationCanceledException e) {
1086
					//workspace.getWorkManager().operationCanceled();
1087
					workspace.getWorkManager().operationCanceled();
1087
					throw e;
1088
					throw e;
1088
				}
1089
				}
1089
			} finally {
1090
			} finally {
Lines 1091-1097 Link Here
1091
			}
1092
			}
1092
		}
1093
		}
1093
	}
1094
	}
1094
	
1095
	/* (non-Javadoc)
1095
	/* (non-Javadoc)
1096
	 * @see IProject#setDescription(IProjectDescription, int, IProgressMonitor)
1096
	 * @see IProject#setDescription(IProjectDescription, int, IProgressMonitor)
1097
	 */
1097
	 */
(-)src/org/eclipse/core/internal/resources/SaveManager.java (-8 / +4 lines)
Lines 7-18 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 * Francis Lynch (Wind River) - [301563] Save and load tree snapshots
10
 *     Francis Lynch (Wind River) - add support for snapshot of project tree
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.core.internal.resources;
12
package org.eclipse.core.internal.resources;
13
13
14
import org.eclipse.core.runtime.OperationCanceledException;
15
16
import org.eclipse.core.filesystem.IFileStore;
14
import org.eclipse.core.filesystem.IFileStore;
17
15
18
import org.eclipse.core.filesystem.EFS;
16
import org.eclipse.core.filesystem.EFS;
Lines 1260-1265 Link Here
1260
			IProgressMonitor monitor) throws CoreException {
1258
			IProgressMonitor monitor) throws CoreException {
1261
		IFileStore store = EFS.getStore(snapshotLocation);
1259
		IFileStore store = EFS.getStore(snapshotLocation);
1262
		IPath snapshotPath = new Path(snapshotLocation.getPath());
1260
		IPath snapshotPath = new Path(snapshotLocation.getPath());
1261
		OutputStream snapOut = store.openOutputStream(EFS.NONE, monitor);
1263
		java.io.File tmpTree = null;
1262
		java.io.File tmpTree = null;
1264
		try {
1263
		try {
1265
			tmpTree = java.io.File.createTempFile("tmp", ".tree");	//$NON-NLS-1$//$NON-NLS-2$
1264
			tmpTree = java.io.File.createTempFile("tmp", ".tree");	//$NON-NLS-1$//$NON-NLS-2$
Lines 1277-1283 Link Here
1277
			} finally {
1276
			} finally {
1278
				output.close();
1277
				output.close();
1279
			}
1278
			}
1280
			OutputStream snapOut = store.openOutputStream(EFS.NONE, monitor);
1281
			out = new ZipOutputStream(snapOut);
1279
			out = new ZipOutputStream(snapOut);
1282
			out.setLevel(Deflater.BEST_COMPRESSION);
1280
			out.setLevel(Deflater.BEST_COMPRESSION);
1283
			ZipEntry e = new ZipEntry("resource-index.tree"); //$NON-NLS-1$
1281
			ZipEntry e = new ZipEntry("resource-index.tree"); //$NON-NLS-1$
Lines 1293-1305 Link Here
1293
			} finally {
1291
			} finally {
1294
				in.close();
1292
				in.close();
1295
			}
1293
			}
1294
			out.close();
1296
		} catch (IOException e) {
1295
		} catch (IOException e) {
1297
			throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, snapshotPath, Messages.resources_copyProblem, e);
1296
			throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, snapshotPath, Messages.resources_copyProblem, e);
1298
		} finally {
1297
		} finally {
1299
			if (out!=null) {
1298
			tmpTree.delete();
1300
				try { out.close(); } catch (IOException e) { /*ignore*/ }
1301
			}
1302
			if (tmpTree!=null) tmpTree.delete();
1303
		}
1299
		}
1304
	}
1300
	}
1305
	
1301
	
(-)src/org/eclipse/core/internal/utils/Messages.java (-1 lines)
Lines 9-15 Link Here
9
 *     IBM - Initial API and implementation
9
 *     IBM - Initial API and implementation
10
 *     Serge Beauchamp (Freescale Semiconductor) - [252996] add resource filtering
10
 *     Serge Beauchamp (Freescale Semiconductor) - [252996] add resource filtering
11
 *     Serge Beauchamp (Freescale Semiconductor) - [229633] Group and Project Path Variable Support
11
 *     Serge Beauchamp (Freescale Semiconductor) - [229633] Group and Project Path Variable Support
12
 * Francis Lynch (Wind River) - [301563] Save and load tree snapshots
13
 *******************************************************************************/
12
 *******************************************************************************/
14
package org.eclipse.core.internal.utils;
13
package org.eclipse.core.internal.utils;
15
14
(-)src/org/eclipse/core/internal/utils/messages.properties (-1 / +1 lines)
Lines 9-15 Link Here
9
#     IBM Corporation - initial API and implementation
9
#     IBM Corporation - initial API and implementation
10
#     Serge Beauchamp (Freescale Semiconductor) - [252996] add resource filtering
10
#     Serge Beauchamp (Freescale Semiconductor) - [252996] add resource filtering
11
#     Serge Beauchamp (Freescale Semiconductor) - [229633] Group and Project Path Variable Support
11
#     Serge Beauchamp (Freescale Semiconductor) - [229633] Group and Project Path Variable Support
12
# Francis Lynch (Wind River) - [301563] Save and load tree snapshots
12
#     Francis Lynch (Wind River) - [301563] project refresh snapshots
13
###############################################################################
13
###############################################################################
14
### Resources plugin messages.
14
### Resources plugin messages.
15
15
(-)src/org/eclipse/core/resources/IProject.java (-12 / +11 lines)
Lines 7-13 Link Here
7
 * 
7
 * 
8
 *  Contributors:
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 * Francis Lynch (Wind River) - [301563] Save and load tree snapshots
10
 *     Francis Lynch (Wind River) - added loadSnapshot/saveSnapshot
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.core.resources;
12
package org.eclipse.core.resources;
13
13
Lines 45-52 Link Here
45
 */
45
 */
46
public interface IProject extends IContainer, IAdaptable {
46
public interface IProject extends IContainer, IAdaptable {
47
	/**
47
	/**
48
	 * Option constant (value 1) indicating that a snapshot to be
48
	 * Option constant (value 1) indicating that the snapshot to be
49
	 * loaded or saved contains a resource tree (refresh information).
49
	 * loaded or saved contains refresh information.
50
	 * @see #loadSnapshot(int, URI, IProgressMonitor)
50
	 * @see #loadSnapshot(int, URI, IProgressMonitor)
51
	 * @see #saveSnapshot(int, URI, IProgressMonitor)
51
	 * @see #saveSnapshot(int, URI, IProgressMonitor)
52
	 * @since 3.6
52
	 * @since 3.6
Lines 585-600 Link Here
585
	 * Must be called after the project has been created, but before it is
585
	 * Must be called after the project has been created, but before it is
586
	 * opened. The options constant controls what kind of snapshot information
586
	 * opened. The options constant controls what kind of snapshot information
587
	 * to load. Valid option values include:<ul>
587
	 * to load. Valid option values include:<ul>
588
	 * <li>@link{IProject#SNAPSHOT_TREE} - load resource tree (refresh info)
588
	 * <li>@link{IProject#SNAPSHOT_REFRESH} - snapshot refresh info
589
	 * </ul>
589
	 * </ul>
590
	 * 
590
	 * 
591
	 * @param options kind of snapshot information to load
591
	 * @param options kind of snapshot information to load
592
	 * @param snapshotLocation URI to load from
592
	 * @param snapshotLocation URI for the snapshot information
593
	 * @param monitor a progress monitor, or <code>null</code> if progress
593
	 * @param monitor a progress monitor, or <code>null</code> if progress
594
	 *		reporting is not desired
594
	 *		reporting is not desired
595
	 * @exception CoreException if this method fails. Reasons include:
595
	 * @exception CoreException if this method fails. Reasons include:
596
	 * <ul>
596
	 * <ul>
597
	 * <li> The snapshot was not found at the specified URI.</li>
597
	 * <li> The snapshot information was not found at the specified URI.</li>
598
	  * </ul>
598
	  * </ul>
599
	 * @exception OperationCanceledException if the operation is canceled.
599
	 * @exception OperationCanceledException if the operation is canceled.
600
	 * @see #saveSnapshot(int, URI, IProgressMonitor) 
600
	 * @see #saveSnapshot(int, URI, IProgressMonitor) 
Lines 661-670 Link Here
661
	 * <ul>
661
	 * <ul>
662
	 * <li>If a {@link #loadSnapshot(int, URI, IProgressMonitor)} call has been made
662
	 * <li>If a {@link #loadSnapshot(int, URI, IProgressMonitor)} call has been made
663
	 * before the open, resources are restored from that file (a file written by
663
	 * before the open, resources are restored from that file (a file written by
664
	 * {@link #saveSnapshot(int, URI, IProgressMonitor)}). When the snapshot includes
664
	 * {@link #saveSnapshot(int, URI, IProgressMonitor)}).
665
	 * resource tree information and can be loaded without error, no refresh is initiated,
665
	 * <li>When the {@link IResource#BACKGROUND_REFRESH} flag is specified,
666
	 * so the project's resource tree will match what the snapshot provides.
667
	 * <li>Otherwise, when the {@link IResource#BACKGROUND_REFRESH} flag is specified,
668
	 * resources on disk will be added to the project in the background after
666
	 * resources on disk will be added to the project in the background after
669
	 * this method returns. Child resources of the project may not be available
667
	 * this method returns. Child resources of the project may not be available
670
	 * until this background refresh completes.
668
	 * until this background refresh completes.
Lines 735-745 Link Here
735
	 * Writes a snapshot of project meta-data into the given location URI.
733
	 * Writes a snapshot of project meta-data into the given location URI.
736
	 * The options constant controls what kind of snapshot information to
734
	 * The options constant controls what kind of snapshot information to
737
	 * write. Valid option values include:<ul>
735
	 * write. Valid option values include:<ul>
738
	 * <li>@link{IProject#SNAPSHOT_TREE} - save resource tree (refresh info)
736
	 * <li>@link{IProject#SNAPSHOT_REFRESH} - snapshot refresh info
739
	 * </ul>
737
	 * </ul>
740
	 * 
738
	 * 
741
	 * @param options kind of snapshot information to save
739
	 * @param options kind of snapshot information to save
742
	 * @param snapshotLocation URI for saving the snapshot to
740
	 * @param snapshotLocation URI for the snapshot information
743
	 * @param monitor a progress monitor, or <code>null</code> if progress
741
	 * @param monitor a progress monitor, or <code>null</code> if progress
744
	 *		reporting is not desired
742
	 *		reporting is not desired
745
	 * @exception CoreException if this method fails. Reasons include:
743
	 * @exception CoreException if this method fails. Reasons include:
Lines 917-920 Link Here
917
	 * @since 3.6
915
	 * @since 3.6
918
	 */
916
	 */
919
	public IPathVariableManager getPathVariableManager();
917
	public IPathVariableManager getPathVariableManager();
918
920
}
919
}

Return to bug 301563