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;
13 import org.eclipse.core.runtime.IProgressMonitor;
16 * Common protocol for Java elements that support source code manipulations such
17 * as copy, move, rename, and delete.
19 * This interface is not intended to be implemented by clients.
22 public interface ISourceManipulation {
24 * Copies this element to the given container.
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
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:
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)
48 * @exception IllegalArgumentException if container is <code>null</code>
50 void copy(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
52 * Deletes this element, forcing if specified and necessary.
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:
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>
65 void delete(boolean force, IProgressMonitor monitor) throws JavaModelException;
67 * Moves this element to the given container.
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
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:
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)
91 * @exception IllegalArgumentException if container is <code>null</code>
93 void move(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
95 * Renames this element to the given name.
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:
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)
112 void rename(String name, boolean replace, IProgressMonitor monitor) throws JavaModelException;