KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > ide > undo > CreateFolderOperation


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.ui.ide.undo;
13
14 import java.net.URI JavaDoc;
15
16 import org.eclipse.core.resources.IFolder;
17 import org.eclipse.ui.internal.ide.undo.ContainerDescription;
18
19 /**
20  * A CreateFolderOperation represents an undoable operation for creating a
21  * folder in the workspace. If a link location is specified, the folder is
22  * considered to be linked to the specified location. If a link location is not
23  * specified, the folder will be created in the location specified by the
24  * handle, and the entire containment path of the folder will be created if it
25  * does not exist. Clients may call the public API from a background thread.
26  *
27  * This class is intended to be instantiated and used by clients. It is not
28  * intended to be subclassed by clients.
29  *
30  * @since 3.3
31  *
32  */

33 public class CreateFolderOperation extends AbstractCreateResourcesOperation {
34
35     /**
36      * Create a CreateFolderOperation
37      *
38      * @param folderHandle
39      * the folder to be created
40      * @param linkLocation
41      * the location of the folder if it is to be linked
42      * @param label
43      * the label of the operation
44      */

45     public CreateFolderOperation(IFolder folderHandle, URI JavaDoc linkLocation,
46             String JavaDoc label) {
47         super(null, label);
48         ContainerDescription containerDescription = ContainerDescription
49                 .fromContainer(folderHandle);
50         if (linkLocation != null) {
51             containerDescription.getFirstLeafFolder().setLocation(linkLocation);
52         }
53         setResourceDescriptions(new ResourceDescription[] { containerDescription });
54     }
55 }
56
Popular Tags