org.eclipse.jdt.core.ISourceManipulation Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* Common protocol for Java elements that support source code manipulations such
* as copy, move, rename, and delete.
*
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ISourceManipulation {
/**
* Copies this element to the given container.
*
* @param container the container
* @param sibling the sibling element before which the copy should be inserted,
* or null
if the copy should be inserted as the last child of
* the container
* @param rename the new name for the element, or null
if the copy
* retains the name of this element
* @param replace true
if any existing child in the container with
* the target name should be replaced, and false
to throw an
* exception in the event of a name collision
* @param monitor a progress monitor
* @exception JavaModelException if this element could not be copied. Reasons include:
*
* - This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
* - A
CoreException
occurred while updating an underlying resource
* - The container is of an incompatible type (INVALID_DESTINATION)
*
- The sibling is not a child of the given container (INVALID_SIBLING)
*
- The new name is invalid (INVALID_NAME)
*
- A child in the container already exists with the same name (NAME_COLLISION)
* and
replace
has been specified as false
* - The container or this element is read-only (READ_ONLY)
*
*
* @exception IllegalArgumentException if container is null
* @see org.eclipse.jdt.core.IJavaModelStatusConstants#INVALID_DESTINATION
*/
void copy(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
/**
* Deletes this element, forcing if specified and necessary.
*
* @param force a flag controlling whether underlying resources that are not
* in sync with the local file system will be tolerated (same as the force flag
* in IResource operations).
* @param monitor a progress monitor
* @exception JavaModelException if this element could not be deleted. Reasons include:
*
* - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
* - A
CoreException
occurred while updating an underlying resource (CORE_EXCEPTION)
* - This element is read-only (READ_ONLY)
*
*/
void delete(boolean force, IProgressMonitor monitor) throws JavaModelException;
/**
* Moves this element to the given container.
*
* @param container the container
* @param sibling the sibling element before which the element should be inserted,
* or null
if the element should be inserted as the last child of
* the container
* @param rename the new name for the element, or null
if the
* element retains its name
* @param replace true
if any existing child in the container with
* the target name should be replaced, and false
to throw an
* exception in the event of a name collision
* @param monitor a progress monitor
* @exception JavaModelException if this element could not be moved. Reasons include:
*
* - This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
* - A
CoreException
occurred while updating an underlying resource
* - The container is of an incompatible type (INVALID_DESTINATION)
*
- The sibling is not a child of the given container (INVALID_SIBLING)
*
- The new name is invalid (INVALID_NAME)
*
- A child in the container already exists with the same name (NAME_COLLISION)
* and
replace
has been specified as false
* - The container or this element is read-only (READ_ONLY)
*
*
* @exception IllegalArgumentException if container is null
* @see org.eclipse.jdt.core.IJavaModelStatusConstants#INVALID_DESTINATION
*/
void move(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
/**
* Renames this element to the given name.
*
* @param name the new name for the element
* @param replace true
if any existing element with the target name
* should be replaced, and false
to throw an exception in the
* event of a name collision
* @param monitor a progress monitor
* @exception JavaModelException if this element could not be renamed. Reasons include:
*
* - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
* - A
CoreException
occurred while updating an underlying resource
* - The new name is invalid (INVALID_NAME)
*
- A child in the container already exists with the same name (NAME_COLLISION)
* and
replace
has been specified as false
* - This element is read-only (READ_ONLY)
*
*/
void rename(String name, boolean replace, IProgressMonitor monitor) throws JavaModelException;
}