1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core;
15 * Common protocol for Java elements that support source code manipulations such
16 * as copy, move, rename, and delete.
18 * This interface is not intended to be implemented by clients.
21 public interface ISourceManipulation {
23 * Copies this element to the given container.
25 * @param container the container
26 * @param sibling the sibling element before which the copy should be inserted,
27 * or <code>null</code> if the copy should be inserted as the last child of
29 * @param rename the new name for the element, or <code>null</code> if the copy
30 * retains the name of this element
31 * @param replace <code>true</code> if any existing child in the container with
32 * the target name should be replaced, and <code>false</code> to throw an
33 * exception in the event of a name collision
34 * @param monitor a progress monitor
35 * @exception JavaModelException if this element could not be copied. Reasons include:
37 * <li> This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
38 * <li> A <code>CoreException</code> occurred while updating an underlying resource
39 * <li> The container is of an incompatible type (INVALID_DESTINATION)
40 * <li> The sibling is not a child of the given container (INVALID_SIBLING)
41 * <li> The new name is invalid (INVALID_NAME)
42 * <li> A child in the container already exists with the same name (NAME_COLLISION)
43 * and <code>replace</code> has been specified as <code>false</code>
44 * <li> The container or this element is read-only (READ_ONLY)
47 * @exception IllegalArgumentException if container is <code>null</code>
49 //void copy(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
51 * Deletes this element, forcing if specified and necessary.
53 * @param force a flag controlling whether underlying resources that are not
54 * in sync with the local file system will be tolerated (same as the force flag
55 * in IResource operations).
56 * @param monitor a progress monitor
57 * @exception JavaModelException if this element could not be deleted. Reasons include:
59 * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
60 * <li> A <code>CoreException</code> occurred while updating an underlying resource (CORE_EXCEPTION)</li>
61 * <li> This element is read-only (READ_ONLY)</li>
64 //void delete(boolean force, IProgressMonitor monitor) throws JavaModelException;
66 * Moves this element to the given container.
68 * @param container the container
69 * @param sibling the sibling element before which the element should be inserted,
70 * or <code>null</code> if the element should be inserted as the last child of
72 * @param rename the new name for the element, or <code>null</code> if the
73 * element retains its name
74 * @param replace <code>true</code> if any existing child in the container with
75 * the target name should be replaced, and <code>false</code> to throw an
76 * exception in the event of a name collision
77 * @param monitor a progress monitor
78 * @exception JavaModelException if this element could not be moved. Reasons include:
80 * <li> This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
81 * <li> A <code>CoreException</code> occurred while updating an underlying resource
82 * <li> The container is of an incompatible type (INVALID_DESTINATION)
83 * <li> The sibling is not a child of the given container (INVALID_SIBLING)
84 * <li> The new name is invalid (INVALID_NAME)
85 * <li> A child in the container already exists with the same name (NAME_COLLISION)
86 * and <code>replace</code> has been specified as <code>false</code>
87 * <li> The container or this element is read-only (READ_ONLY)
90 * @exception IllegalArgumentException if container is <code>null</code>
92 //void move(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
94 * Renames this element to the given name.
96 * @param name the new name for the element
97 * @param replace <code>true</code> if any existing element with the target name
98 * should be replaced, and <code>false</code> to throw an exception in the
99 * event of a name collision
100 * @param monitor a progress monitor
101 * @exception JavaModelException if this element could not be renamed. Reasons include:
103 * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
104 * <li> A <code>CoreException</code> occurred while updating an underlying resource
105 * <li> The new name is invalid (INVALID_NAME)
106 * <li> A child in the container already exists with the same name (NAME_COLLISION)
107 * and <code>replace</code> has been specified as <code>false</code>
108 * <li> This element is read-only (READ_ONLY)
111 //void rename(String name, boolean replace, IProgressMonitor monitor) throws JavaModelException;