mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
8758a144a7
commit
6de0d0163b
7 changed files with 122 additions and 160 deletions
|
@ -167,7 +167,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if IFile is a shared library, i.e. libxx.so
|
||||
* Returns true if IFile is a shared library, i.e. libxx.so
|
||||
*/
|
||||
public boolean isSharedLib(IFile file) {
|
||||
ICElement celement = create(file);
|
||||
|
@ -178,7 +178,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if IFile is a an object(ELF), i.e. *.o
|
||||
* Returns true if IFile is a an object(ELF), i.e. *.o
|
||||
*/
|
||||
public boolean isObject(IFile file) {
|
||||
ICElement celement = create(file);
|
||||
|
@ -189,7 +189,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if IFile is an ELF executable
|
||||
* Returns true if IFile is an ELF executable
|
||||
*/
|
||||
public boolean isExecutable(IFile file) {
|
||||
ICElement celement = create(file);
|
||||
|
@ -200,7 +200,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if IFile is an ELF.
|
||||
* Returns true if IFile is an ELF.
|
||||
*/
|
||||
public boolean isBinary(IFile file) {
|
||||
ICElement celement = create(file);
|
||||
|
@ -208,7 +208,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if IFile is an Achive, *.a
|
||||
* Returns true if IFile is an Achive, *.a
|
||||
*/
|
||||
public boolean isArchive(IFile file) {
|
||||
ICElement celement = create(file);
|
||||
|
@ -216,7 +216,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if IFile is a possible TranslationUnit.
|
||||
* Returns true if IFile is a possible TranslationUnit.
|
||||
*/
|
||||
public static boolean isTranslationUnit(IFile file) {
|
||||
if (file != null) {
|
||||
|
@ -229,7 +229,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return an array of the register contentTypes.
|
||||
* Returns an array of the register contentTypes.
|
||||
* @return String[] ids
|
||||
*/
|
||||
public static String[] getRegistedContentTypeIds() {
|
||||
|
@ -237,7 +237,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidTranslationUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -254,7 +254,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidHeaderUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -269,7 +269,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidSourceUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -289,7 +289,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidCSourceUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -303,7 +303,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidCXXSourceUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -317,7 +317,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidASMSourceUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -331,7 +331,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidCXXHeaderUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -345,7 +345,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if name is a valid name for a translation unit.
|
||||
* Returns true if name is a valid name for a translation unit.
|
||||
*/
|
||||
public static boolean isValidCHeaderUnitName(IProject project, String name) {
|
||||
IContentType contentType = CCorePlugin.getContentType(project, name);
|
||||
|
@ -379,7 +379,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if project has C nature.
|
||||
* Returns true if project has C nature.
|
||||
*/
|
||||
public static boolean hasCNature(IProject project) {
|
||||
try {
|
||||
|
@ -390,7 +390,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if project has C++ nature.
|
||||
* Returns true if project has C++ nature.
|
||||
*/
|
||||
public static boolean hasCCNature(IProject project) {
|
||||
try {
|
||||
|
@ -1036,7 +1036,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the IPathEntryStore of the project.
|
||||
* Returns the IPathEntryStore of the project.
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static IPathEntryStore getPathEntryStore(IProject project) throws CoreException {
|
||||
|
@ -1113,7 +1113,7 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the singleton.
|
||||
* Returns the singleton.
|
||||
*/
|
||||
public static CoreModel getDefault() {
|
||||
if (cmodel == null) {
|
||||
|
|
|
@ -19,11 +19,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
* <em>the</em> C model element.
|
||||
* The C model element needs to be opened before it can be navigated or manipulated.
|
||||
* The C model element has no parent (it is the root of the C element
|
||||
* hierarchy). Its children are <code>ICProject</code>s.
|
||||
* hierarchy). Its children are {@code ICProject}s.
|
||||
* <p>
|
||||
* This interface provides methods for performing copy, move, rename, and
|
||||
* delete operations on multiple C elements.
|
||||
* </p>
|
||||
*
|
||||
* @see CoreModel#create(org.eclipse.core.resources.IWorkspaceRoot)
|
||||
*
|
||||
|
@ -39,56 +38,55 @@ public interface ICModel extends ICElement, IParent, IOpenable {
|
|||
* its associated container.
|
||||
* <p>
|
||||
* Optionally, each copy can positioned before a sibling
|
||||
* element. If <code>null</code> is specified for a given sibling, the copy
|
||||
* element. If {@code null} is specified for a given sibling, the copy
|
||||
* is inserted as the last child of its associated container.
|
||||
* </p>
|
||||
* <p>
|
||||
* Optionally, each copy can be renamed. If
|
||||
* <code>null</code> is specified for the new name, the copy
|
||||
* {@code null} is specified for the new name, the copy
|
||||
* is not renamed.
|
||||
* </p>
|
||||
* <p>
|
||||
* Optionally, any existing child in the destination container with
|
||||
* the same name can be replaced by specifying <code>true</code> for
|
||||
* the same name can be replaced by specifying {@code true} for
|
||||
* force. Otherwise an exception is thrown in the event that a name
|
||||
* collision occurs.
|
||||
* </p>
|
||||
*
|
||||
* @param elements the elements to copy
|
||||
* @param containers the container, or list of containers
|
||||
* @param siblings the list of siblings element any of which may be
|
||||
* <code>null</code>; or <code>null</code>
|
||||
* @param renamings the list of new names any of which may be
|
||||
* <code>null</code>; or <code>null</code>
|
||||
* @param replace <code>true</code> if any existing child in a target container
|
||||
* with the target name should be replaced, and <code>false</code> to throw an
|
||||
* exception in the event of a name collision
|
||||
* @param siblings the list of sibling elements, any of which may be
|
||||
* {@code null}, or {@code null}
|
||||
* @param renamings the list of new names, any of which may be
|
||||
* {@code null}, or {@code null}
|
||||
* @param replace {@code true} if any existing child in a target container
|
||||
* with the target name should be replaced, and {@code false} to throw an
|
||||
* exception in the event of a name collision
|
||||
* @param monitor a progress monitor
|
||||
* @exception CModelException if an element could not be copied. Reasons include:
|
||||
* <ul>
|
||||
* <li> A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
|
||||
* <li> A <code>CoreException</code> occurred while updating an underlying resource
|
||||
* <li> A container is of an incompatible type (<code>INVALID_DESTINATION</code>)
|
||||
* <li> A sibling is not a child of it associated container (<code>INVALID_SIBLING</code>)
|
||||
* <li> A new name is invalid (<code>INVALID_NAME</code>)
|
||||
* <li> A {@code CoreException} occurred while updating an underlying resource
|
||||
* <li> A container is of an incompatible type ({@code INVALID_DESTINATION})
|
||||
* <li> A sibling is not a child of it associated container ({@code INVALID_SIBLING})
|
||||
* <li> A new name is invalid ({@code INVALID_NAME})
|
||||
* <li> A child in its associated container already exists with the same
|
||||
* name and <code>replace</code> has been specified as <code>false</code> (<code>NAME_COLLISION</code>)
|
||||
* <li> A container or element is read-only (<code>READ_ONLY</code>)
|
||||
* name and {@code replace} has been specified as {@code false}
|
||||
* ({@code NAME_COLLISION})
|
||||
* <li> A container or element is read-only ({@code READ_ONLY})
|
||||
* </ul>
|
||||
*/
|
||||
void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException;
|
||||
void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings,
|
||||
boolean replace, IProgressMonitor monitor) throws CModelException;
|
||||
/**
|
||||
* Deletes the given elements, forcing the operation if necessary and specified.
|
||||
*
|
||||
* @param elements the elements to delete
|
||||
* @param force a flag controlling whether underlying resources that are not
|
||||
* in sync with the local file system will be tolerated
|
||||
* in sync with the local file system will be tolerated
|
||||
* @param monitor a progress monitor
|
||||
* @exception CModelException if an element could not be deleted. Reasons include:
|
||||
* <ul>
|
||||
* <li> A specified element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
|
||||
* <li> A <code>CoreException</code> occurred while updating an underlying resource
|
||||
* <li> An element is read-only (<code>READ_ONLY</code>)
|
||||
* <li> A {@code CoreException} occurred while updating an underlying resource
|
||||
* <li> An element is read-only ({@code READ_ONLY})
|
||||
* </ul>
|
||||
*/
|
||||
void delete(ICElement[] elements, boolean force, IProgressMonitor monitor) throws CModelException;
|
||||
|
@ -101,46 +99,45 @@ public interface ICModel extends ICElement, IParent, IOpenable {
|
|||
* its associated container.
|
||||
* <p>
|
||||
* Optionally, each element can positioned before a sibling
|
||||
* element. If <code>null</code> is specified for sibling, the element
|
||||
* element. If {@code null} is specified for sibling, the element
|
||||
* is inserted as the last child of its associated container.
|
||||
* </p>
|
||||
* <p>
|
||||
* Optionally, each element can be renamed. If
|
||||
* <code>null</code> is specified for the new name, the element
|
||||
* {@code null} is specified for the new name, the element
|
||||
* is not renamed.
|
||||
* </p>
|
||||
* <p>
|
||||
* Optionally, any existing child in the destination container with
|
||||
* the same name can be replaced by specifying <code>true</code> for
|
||||
* the same name can be replaced by specifying {@code true} for
|
||||
* force. Otherwise an exception is thrown in the event that a name
|
||||
* collision occurs.
|
||||
* </p>
|
||||
*
|
||||
* @param elements the elements to move
|
||||
* @param containers the container, or list of containers
|
||||
* @param siblings the list of siblings element any of which may be
|
||||
* <code>null</code>; or <code>null</code>
|
||||
* {@code null}; or {@code null}
|
||||
* @param renamings the list of new names any of which may be
|
||||
* <code>null</code>; or <code>null</code>
|
||||
* @param replace <code>true</code> if any existing child in a target container
|
||||
* with the target name should be replaced, and <code>false</code> to throw an
|
||||
* exception in the event of a name collision
|
||||
* {@code null}; or {@code null}
|
||||
* @param replace {@code true} if any existing child in a target container
|
||||
* with the target name should be replaced, and {@code false} to throw an
|
||||
* exception in the event of a name collision
|
||||
* @param monitor a progress monitor
|
||||
* @exception CModelException if an element could not be moved. Reasons include:
|
||||
* <ul>
|
||||
* <li> A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
|
||||
* <li> A <code>CoreException</code> occurred while updating an underlying resource
|
||||
* <li> A container is of an incompatible type (<code>INVALID_DESTINATION</code>)
|
||||
* <li> A sibling is not a child of it associated container (<code>INVALID_SIBLING</code>)
|
||||
* <li> A new name is invalid (<code>INVALID_NAME</code>)
|
||||
* <li> A {@code CoreException} occurred while updating an underlying resource
|
||||
* <li> A container is of an incompatible type ({@code INVALID_DESTINATION})
|
||||
* <li> A sibling is not a child of it associated container ({@code INVALID_SIBLING})
|
||||
* <li> A new name is invalid ({@code INVALID_NAME})
|
||||
* <li> A child in its associated container already exists with the same
|
||||
* name and <code>replace</code> has been specified as <code>false</code> (<code>NAME_COLLISION</code>)
|
||||
* <li> A container or element is read-only (<code>READ_ONLY</code>)
|
||||
* name and {@code replace} has been specified as {@code false}
|
||||
* ({@code NAME_COLLISION})
|
||||
* <li> A container or element is read-only ({@code READ_ONLY})
|
||||
* </ul>
|
||||
*
|
||||
* @exception IllegalArgumentException any element or container is <code>null</code>
|
||||
* @exception IllegalArgumentException any element or container is {@code null}
|
||||
*/
|
||||
void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException;
|
||||
void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings,
|
||||
boolean replace, IProgressMonitor monitor) throws CModelException;
|
||||
|
||||
/**
|
||||
* Renames the given elements as specified.
|
||||
|
@ -152,46 +149,44 @@ public interface ICModel extends ICElement, IParent, IOpenable {
|
|||
* @param elements the elements to rename
|
||||
* @param destinations the container, or list of containers
|
||||
* @param names the list of new names
|
||||
* @param replace <code>true</code> if an existing child in a target container
|
||||
* with the target name should be replaced, and <code>false</code> to throw an
|
||||
* exception in the event of a name collision
|
||||
* @param replace {@code true} if an existing child in a target container
|
||||
* with the target name should be replaced, and {@code false} to throw an
|
||||
* exception in the event of a name collision
|
||||
* @param monitor a progress monitor
|
||||
* @exception CModelException if an element could not be renamed. Reasons include:
|
||||
* <ul>
|
||||
* <li> A specified element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
|
||||
* <li> A <code>CoreException</code> occurred while updating an underlying resource
|
||||
* <li> A new name is invalid (<code>INVALID_NAME</code>)
|
||||
* <li> A child already exists with the same name and <code>replace</code> has been specified as <code>false</code> (<code>NAME_COLLISION</code>)
|
||||
* <li> An element is read-only (<code>READ_ONLY</code>)
|
||||
* <li> A {@code CoreException} occurred while updating an underlying resource
|
||||
* <li> A new name is invalid ({@code INVALID_NAME})
|
||||
* <li> A child already exists with the same name and {@code replace} has been specified as
|
||||
* {@code false} ({@code NAME_COLLISION})
|
||||
* <li> An element is read-only ({@code READ_ONLY})
|
||||
* </ul>
|
||||
*/
|
||||
void rename(ICElement[] elements, ICElement[] destinations, String[] names, boolean replace, IProgressMonitor monitor) throws CModelException;
|
||||
void rename(ICElement[] elements, ICElement[] destinations, String[] names, boolean replace,
|
||||
IProgressMonitor monitor) throws CModelException;
|
||||
|
||||
/**
|
||||
* Returns the C project with the given name. This is a handle-only method.
|
||||
* The project may or may not exist.
|
||||
*
|
||||
* @param name of the Project
|
||||
* @param name of the project
|
||||
*/
|
||||
ICProject getCProject(String name);
|
||||
|
||||
/**
|
||||
* Returns the C projects.
|
||||
*
|
||||
*/
|
||||
ICProject[] getCProjects() throws CModelException;
|
||||
|
||||
/**
|
||||
* Returns an array of non-C resources (i.e. non-C projects) in
|
||||
* the workspace.
|
||||
* Returns an array of non-C resources (i.e. non-C projects) in the workspace.
|
||||
* <p>
|
||||
* Non-C projects include all projects that are closed (even if they have the
|
||||
* C nature).
|
||||
* </p>
|
||||
*
|
||||
* Non-C projects include all projects that are closed (even if they have the C nature).
|
||||
*
|
||||
* @return an array of non-C projects contained in the workspace.
|
||||
* @throws CModelException if this element does not exist or if an
|
||||
* exception occurs while accessing its corresponding resource
|
||||
* @throws CModelException if this element does not exist or if an exception occurs
|
||||
* while accessing its corresponding resource
|
||||
* @since 2.1
|
||||
*/
|
||||
Object[] getNonCResources() throws CModelException;
|
||||
|
@ -200,5 +195,4 @@ public interface ICModel extends ICElement, IParent, IOpenable {
|
|||
* Returns the workspace associated with this C model.
|
||||
*/
|
||||
IWorkspace getWorkspace();
|
||||
|
||||
}
|
||||
|
|
|
@ -16,36 +16,22 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry {
|
||||
// IPath fFullPath;
|
||||
// IPath fLocation;
|
||||
// private IPath fPath;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Creates an ACPathEntry.
|
||||
*
|
||||
* @param rc - a resource in the workspace.
|
||||
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
|
||||
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
|
||||
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
|
||||
*/
|
||||
ACPathEntry(IResource rc, int flags) {
|
||||
super(rc.getFullPath().toString(), flags | RESOLVED | VALUE_WORKSPACE_PATH);
|
||||
// fFullPath = rc.getFullPath();
|
||||
// fPath = rc.getFullPath();
|
||||
// fLocation = rc.getLocation();
|
||||
}
|
||||
|
||||
/* public ACLanguageSettingPathEntry(IPath fullPath, IPath location, int flags) {
|
||||
super(flags);
|
||||
fLocation = location;
|
||||
fFullPath = fullPath;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Creates an ACPathEntry.
|
||||
*
|
||||
* @param name - resource path. The path can be an absolute location on the local file-system
|
||||
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
|
||||
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
|
||||
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
|
||||
*/
|
||||
ACPathEntry(String name, int flags) {
|
||||
|
@ -61,11 +47,6 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
*/
|
||||
ACPathEntry(IPath path, int flags) {
|
||||
super(path.toString(), flags /*| RESOLVED*/);
|
||||
// fPath = path;
|
||||
// if (isValueWorkspacePath())
|
||||
// fFullPath = path;
|
||||
// else
|
||||
// fLocation = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,8 +62,8 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
|
||||
protected IPath fullPathForLocation(IPath location){
|
||||
IResource rcs[] = isFile() ?
|
||||
(IResource[])ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(location)
|
||||
: (IResource[])ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(location);
|
||||
(IResource[]) ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(location) :
|
||||
(IResource[]) ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(location);
|
||||
|
||||
if (rcs.length > 0)
|
||||
return rcs[0].getFullPath();
|
||||
|
|
|
@ -10,14 +10,13 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* CoreModelMessages
|
||||
*
|
||||
* @noreference This class is not intended to be referenced by clients.
|
||||
*/
|
||||
public class CoreModelMessages {
|
||||
private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.core.model.CoreModelMessages"; //$NON-NLS-1$
|
||||
|
@ -44,29 +43,27 @@ public class CoreModelMessages {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with the argument
|
||||
* Returns a string from the resource bundle and formats it with the argument
|
||||
*
|
||||
* @param key the string used to get the bundle value, must not be null
|
||||
* @param key the string used to get the bundle value, must not be {@code null}
|
||||
*/
|
||||
public static String getFormattedString(String key) {
|
||||
return getString(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with the argument
|
||||
* Returns a string from the resource bundle and formats it with the argument
|
||||
*
|
||||
* @param key the string used to get the bundle value, must not be null
|
||||
* @param key the string used to get the bundle value, must not be {@code null}
|
||||
*/
|
||||
public static String getFormattedString(String key, Object arg) {
|
||||
return MessageFormat.format(getString(key), new Object[] { arg });
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with arguments
|
||||
* Returns a string from the resource bundle and formats it with arguments
|
||||
*/
|
||||
public static String getFormattedString(String key, Object[] args) {
|
||||
return MessageFormat.format(getString(key), args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# Anton Leherbauer (Wind River Systems)
|
||||
# Markus Schorn (Wind River Systems)
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# Anton Leherbauer (Wind River Systems)
|
||||
# Markus Schorn (Wind River Systems)
|
||||
###############################################################################
|
||||
|
||||
### CoreModel messages.
|
||||
|
|
|
@ -24,9 +24,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
/**
|
||||
* Element info for ISourceReference elements.
|
||||
*/
|
||||
/* package */
|
||||
class SourceManipulationInfo extends CElementInfo {
|
||||
|
||||
protected int fStartPos;
|
||||
protected int fLength;
|
||||
protected int fIdStartPos;
|
||||
|
@ -79,16 +77,11 @@ class SourceManipulationInfo extends CElementInfo {
|
|||
}
|
||||
|
||||
protected ISourceRange getSourceRange() {
|
||||
return new SourceRange(fStartPos,
|
||||
fLength,
|
||||
fIdStartPos,
|
||||
fIdLength,
|
||||
fStartLine,
|
||||
fEndLine);
|
||||
return new SourceRange(fStartPos, fLength, fIdStartPos, fIdLength, fStartLine, fEndLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ISourceReference
|
||||
* @see ISourceReference#getSource()
|
||||
*/
|
||||
public String getSource() throws CModelException {
|
||||
ITranslationUnit unit = getTranslationUnit();
|
||||
|
@ -103,7 +96,7 @@ class SourceManipulationInfo extends CElementInfo {
|
|||
}
|
||||
try {
|
||||
return buffer.getText(offset, length);
|
||||
} catch(RuntimeException e) {
|
||||
} catch (RuntimeException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -127,93 +120,90 @@ class SourceManipulationInfo extends CElementInfo {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see IMember
|
||||
* @see IMember#getTranslationUnit()
|
||||
*/
|
||||
public ITranslationUnit getTranslationUnit() {
|
||||
ICElement celem = getElement();
|
||||
for (; celem != null; celem = celem.getParent()) {
|
||||
for (ICElement celem = getElement(); celem != null; celem = celem.getParent()) {
|
||||
if (celem instanceof ITranslationUnit)
|
||||
return (ITranslationUnit)celem;
|
||||
return (ITranslationUnit) celem;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ISourceManipulation
|
||||
* @see ISourceManipulation#copy(ICElement, ICElement, String, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void copy(ICElement container, ICElement sibling, String rename, boolean force,
|
||||
IProgressMonitor monitor) throws CModelException {
|
||||
if (container == null) {
|
||||
throw new IllegalArgumentException(CoreModelMessages.getString("operation.nullContainer")); //$NON-NLS-1$
|
||||
}
|
||||
ICElement[] elements= new ICElement[] {getElement()};
|
||||
ICElement[] containers= new ICElement[] {container};
|
||||
ICElement[] elements= new ICElement[] { getElement() };
|
||||
ICElement[] containers= new ICElement[] { container };
|
||||
ICElement[] siblings= null;
|
||||
if (sibling != null) {
|
||||
siblings= new ICElement[] {sibling};
|
||||
siblings= new ICElement[] { sibling };
|
||||
}
|
||||
String[] renamings= null;
|
||||
if (rename != null) {
|
||||
renamings= new String[] {rename};
|
||||
renamings= new String[] { rename };
|
||||
}
|
||||
getElement().getCModel().copy(elements, containers, siblings, renamings, force, monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ISourceManipulation
|
||||
* @see ISourceManipulation#delete(boolean, IProgressMonitor)
|
||||
*/
|
||||
public void delete(boolean force, IProgressMonitor monitor) throws CModelException {
|
||||
ICElement[] elements = new ICElement[] {getElement()};
|
||||
ICElement[] elements = new ICElement[] { getElement() };
|
||||
getElement().getCModel().delete(elements, force, monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ISourceManipulation
|
||||
* @see ISourceManipulation#move(ICElement, ICElement, String, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void move(ICElement container, ICElement sibling, String rename, boolean force,
|
||||
IProgressMonitor monitor) throws CModelException {
|
||||
IProgressMonitor monitor) throws CModelException {
|
||||
if (container == null) {
|
||||
throw new IllegalArgumentException(CoreModelMessages.getString("operation.nullContainer")); //$NON-NLS-1$
|
||||
}
|
||||
ICElement[] elements= new ICElement[] {getElement()};
|
||||
ICElement[] containers= new ICElement[] {container};
|
||||
ICElement[] elements= new ICElement[] { getElement() };
|
||||
ICElement[] containers= new ICElement[] { container };
|
||||
ICElement[] siblings= null;
|
||||
if (sibling != null) {
|
||||
siblings= new ICElement[] {sibling};
|
||||
siblings= new ICElement[] { sibling };
|
||||
}
|
||||
String[] renamings= null;
|
||||
if (rename != null) {
|
||||
renamings= new String[] {rename};
|
||||
renamings= new String[] { rename };
|
||||
}
|
||||
getElement().getCModel().move(elements, containers, siblings, renamings, force, monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ISourceManipulation
|
||||
* @see ISourceManipulation#rename(String, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("element.nullName"); //$NON-NLS-1$
|
||||
}
|
||||
ICElement[] elements= new ICElement[] {getElement()};
|
||||
ICElement[] dests= new ICElement[] {getElement().getParent()};
|
||||
String[] renamings= new String[] {name};
|
||||
ICElement[] elements= new ICElement[] { getElement() };
|
||||
ICElement[] dests= new ICElement[] { getElement().getParent() };
|
||||
String[] renamings= new String[] { name };
|
||||
getElement().getCModel().rename(elements, dests, renamings, force, monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the element modifiers
|
||||
* @return int
|
||||
* Returns the element modifiers.
|
||||
*/
|
||||
public int getModifiers(){
|
||||
public int getModifiers() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* subclasses should override
|
||||
* Subclasses should override
|
||||
*/
|
||||
public boolean hasSameContentsAs( SourceManipulationInfo otherInfo){
|
||||
return (this.element.fType == otherInfo.element.fType);
|
||||
public boolean hasSameContentsAs(SourceManipulationInfo otherInfo) {
|
||||
return element.fType == otherInfo.element.fType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,12 +106,12 @@ public class CRenameClassProcessor extends CRenameTypeProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
renameCompilationUnits(ctype);
|
||||
renameTranslationUnits(ctype);
|
||||
}
|
||||
return bindings.toArray(new IBinding[bindings.size()]);
|
||||
}
|
||||
|
||||
private void renameCompilationUnits(ICPPBinding binding) {
|
||||
private void renameTranslationUnits(ICPPBinding binding) {
|
||||
IIndex index = getIndex();
|
||||
if (index == null) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue