KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > ISourceManipulation


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 package org.eclipse.jdt.core;
12
13 import org.eclipse.core.runtime.IProgressMonitor;
14
15 /**
16  * Common protocol for Java elements that support source code manipulations such
17  * as copy, move, rename, and delete.
18  * <p>
19  * This interface is not intended to be implemented by clients.
20  * </p>
21  */

22 public interface ISourceManipulation {
23 /**
24  * Copies this element to the given container.
25  *
26  * @param container the container
27  * @param sibling the sibling element before which the copy should be inserted,
28  * or <code>null</code> if the copy should be inserted as the last child of
29  * the container
30  * @param rename the new name for the element, or <code>null</code> if the copy
31  * retains the name of this element
32  * @param replace <code>true</code> if any existing child in the container with
33  * the target name should be replaced, and <code>false</code> to throw an
34  * exception in the event of a name collision
35  * @param monitor a progress monitor
36  * @exception JavaModelException if this element could not be copied. Reasons include:
37  * <ul>
38  * <li> This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
39  * <li> A <code>CoreException</code> occurred while updating an underlying resource
40  * <li> The container is of an incompatible type (INVALID_DESTINATION)
41  * <li> The sibling is not a child of the given container (INVALID_SIBLING)
42  * <li> The new name is invalid (INVALID_NAME)
43  * <li> A child in the container already exists with the same name (NAME_COLLISION)
44  * and <code>replace</code> has been specified as <code>false</code>
45  * <li> The container or this element is read-only (READ_ONLY)
46  * </ul>
47  *
48  * @exception IllegalArgumentException if container is <code>null</code>
49  */

50 void copy(IJavaElement container, IJavaElement sibling, String JavaDoc rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
51 /**
52  * Deletes this element, forcing if specified and necessary.
53  *
54  * @param force a flag controlling whether underlying resources that are not
55  * in sync with the local file system will be tolerated (same as the force flag
56  * in IResource operations).
57  * @param monitor a progress monitor
58  * @exception JavaModelException if this element could not be deleted. Reasons include:
59  * <ul>
60  * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
61  * <li> A <code>CoreException</code> occurred while updating an underlying resource (CORE_EXCEPTION)</li>
62  * <li> This element is read-only (READ_ONLY)</li>
63  * </ul>
64  */

65 void delete(boolean force, IProgressMonitor monitor) throws JavaModelException;
66 /**
67  * Moves this element to the given container.
68  *
69  * @param container the container
70  * @param sibling the sibling element before which the element should be inserted,
71  * or <code>null</code> if the element should be inserted as the last child of
72  * the container
73  * @param rename the new name for the element, or <code>null</code> if the
74  * element retains its name
75  * @param replace <code>true</code> if any existing child in the container with
76  * the target name should be replaced, and <code>false</code> to throw an
77  * exception in the event of a name collision
78  * @param monitor a progress monitor
79  * @exception JavaModelException if this element could not be moved. Reasons include:
80  * <ul>
81  * <li> This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
82  * <li> A <code>CoreException</code> occurred while updating an underlying resource
83  * <li> The container is of an incompatible type (INVALID_DESTINATION)
84  * <li> The sibling is not a child of the given container (INVALID_SIBLING)
85  * <li> The new name is invalid (INVALID_NAME)
86  * <li> A child in the container already exists with the same name (NAME_COLLISION)
87  * and <code>replace</code> has been specified as <code>false</code>
88  * <li> The container or this element is read-only (READ_ONLY)
89  * </ul>
90  *
91  * @exception IllegalArgumentException if container is <code>null</code>
92  */

93 void move(IJavaElement container, IJavaElement sibling, String JavaDoc rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
94 /**
95  * Renames this element to the given name.
96  *
97  * @param name the new name for the element
98  * @param replace <code>true</code> if any existing element with the target name
99  * should be replaced, and <code>false</code> to throw an exception in the
100  * event of a name collision
101  * @param monitor a progress monitor
102  * @exception JavaModelException if this element could not be renamed. Reasons include:
103  * <ul>
104  * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
105  * <li> A <code>CoreException</code> occurred while updating an underlying resource
106  * <li> The new name is invalid (INVALID_NAME)
107  * <li> A child in the container already exists with the same name (NAME_COLLISION)
108  * and <code>replace</code> has been specified as <code>false</code>
109  * <li> This element is read-only (READ_ONLY)
110  * </ul>
111  */

112 void rename(String JavaDoc name, boolean replace, IProgressMonitor monitor) throws JavaModelException;
113 }
114
Popular Tags