01: /*******************************************************************************
02: * Copyright (c) 2006, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.ide.undo;
11:
12: import java.net.URI;
13:
14: import org.eclipse.core.resources.IFolder;
15: import org.eclipse.ui.internal.ide.undo.ContainerDescription;
16:
17: /**
18: * A CreateFolderOperation represents an undoable operation for creating a
19: * folder in the workspace. If a link location is specified, the folder is
20: * considered to be linked to the specified location. If a link location is not
21: * specified, the folder will be created in the location specified by the
22: * handle, and the entire containment path of the folder will be created if it
23: * does not exist. Clients may call the public API from a background thread.
24: *
25: * This class is intended to be instantiated and used by clients. It is not
26: * intended to be subclassed by clients.
27: *
28: * @since 3.3
29: *
30: */
31: public class CreateFolderOperation extends
32: AbstractCreateResourcesOperation {
33:
34: /**
35: * Create a CreateFolderOperation
36: *
37: * @param folderHandle
38: * the folder to be created
39: * @param linkLocation
40: * the location of the folder if it is to be linked
41: * @param label
42: * the label of the operation
43: */
44: public CreateFolderOperation(IFolder folderHandle,
45: URI linkLocation, String label) {
46: super (null, label);
47: ContainerDescription containerDescription = ContainerDescription
48: .fromContainer(folderHandle);
49: if (linkLocation != null) {
50: containerDescription.getFirstLeafFolder().setLocation(
51: linkLocation);
52: }
53: setResourceDescriptions(new ResourceDescription[] { containerDescription });
54: }
55: }
|