1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 456099. Moved a premature assertion.

This commit is contained in:
Sergey Prigogin 2014-12-30 09:57:56 -08:00
parent b235e472b5
commit 8758a144a7
2 changed files with 5 additions and 2 deletions

View file

@ -84,12 +84,14 @@ import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.osgi.util.NLS;
/** /**
* @see ITranslationUnit * @see ITranslationUnit
@ -371,17 +373,20 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override @Override
public void delete(boolean force, IProgressMonitor monitor) throws CModelException { public void delete(boolean force, IProgressMonitor monitor) throws CModelException {
Assert.isTrue(!isReadOnly(), NLS.bind("Translation unit {0} must not be read-only", getElementName())); //$NON-NLS-1$
getSourceManipulationInfo().delete(force, monitor); getSourceManipulationInfo().delete(force, monitor);
} }
@Override @Override
public void move(ICElement container, ICElement sibling, String rename, boolean force, public void move(ICElement container, ICElement sibling, String rename, boolean force,
IProgressMonitor monitor) throws CModelException { IProgressMonitor monitor) throws CModelException {
Assert.isTrue(!isReadOnly(), NLS.bind("Translation unit {0} must not be read-only", getElementName())); //$NON-NLS-1$
getSourceManipulationInfo().move(container, sibling, rename, force, monitor); getSourceManipulationInfo().move(container, sibling, rename, force, monitor);
} }
@Override @Override
public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException { public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException {
Assert.isTrue(!isReadOnly(), NLS.bind("Translation unit {0} must not be read-only", getElementName())); //$NON-NLS-1$
getSourceManipulationInfo().rename(name, force, monitor); getSourceManipulationInfo().rename(name, force, monitor);
} }

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.ui.refactoring.changes; package org.eclipse.cdt.internal.ui.refactoring.changes;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -28,7 +27,6 @@ public final class RenameTranslationUnitChange extends AbstractCElementRenameCha
public RenameTranslationUnitChange(ITranslationUnit tu, String newName) { public RenameTranslationUnitChange(ITranslationUnit tu, String newName) {
this(tu.getResource().getFullPath(), tu.getElementName(), newName, IResource.NULL_STAMP); this(tu.getResource().getFullPath(), tu.getElementName(), newName, IResource.NULL_STAMP);
Assert.isTrue(!tu.isReadOnly(), "Translation unit must not be read-only"); //$NON-NLS-1$
} }
private RenameTranslationUnitChange(IPath resourcePath, String oldName, String newName, long stampToRestore) { private RenameTranslationUnitChange(IPath resourcePath, String oldName, String newName, long stampToRestore) {