本文整理汇总了Java中org.eclipse.jdt.internal.corext.ValidateEditException类的典型用法代码示例。如果您正苦于以下问题:Java ValidateEditException类的具体用法?Java ValidateEditException怎么用?Java ValidateEditException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidateEditException类属于org.eclipse.jdt.internal.corext包,在下文中一共展示了ValidateEditException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyEdit
import org.eclipse.jdt.internal.corext.ValidateEditException; //导入依赖的package包/类
/**
* Applies an text edit to a compilation unit. Filed bug 117694 against jdt.core.
*
* @param cu the compilation unit to apply the edit to
* @param edit the edit to apply
* @param save is set, save the CU after the edit has been applied
* @param monitor the progress monitor to use
* @throws CoreException Thrown when the access to the CU failed
* @throws ValidateEditException if validate edit fails
*/
public static void applyEdit(
ICompilationUnit cu, TextEdit edit, boolean save, IProgressMonitor monitor)
throws CoreException, ValidateEditException {
IFile file = (IFile) cu.getResource();
if (!save || !file.exists()) {
cu.applyTextEdit(edit, monitor);
} else {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask(CorextMessages.JavaModelUtil_applyedit_operation, 2);
try {
// IStatus status= Resources.makeCommittable(file, null);
// if (!status.isOK()) {
// throw new ValidateEditException(status);
// }
cu.applyTextEdit(edit, new SubProgressMonitor(monitor, 1));
cu.save(new SubProgressMonitor(monitor, 1), true);
} finally {
monitor.done();
}
}
}
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:JavaModelUtil.java
示例2: applyEdit
import org.eclipse.jdt.internal.corext.ValidateEditException; //导入依赖的package包/类
private static void applyEdit(ICompilationUnit cu, TextEdit edit, boolean save, IProgressMonitor monitor)
throws CoreException, ValidateEditException {
IFile file = (IFile) cu.getResource();
if (!save || !file.exists()) {
cu.applyTextEdit(edit, monitor);
} else {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask(CorextMessages.JavaModelUtil_applyedit_operation, 2);
try {
IStatus status = Resources.makeCommittable(file, null);
if (!status.isOK()) {
throw new ValidateEditException(status);
}
cu.applyTextEdit(edit, SubMonitor.convert(monitor, 1));
cu.save(SubMonitor.convert(monitor, 1), true);
} finally {
monitor.done();
}
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:TypeCreator.java
示例3: applyEdit
import org.eclipse.jdt.internal.corext.ValidateEditException; //导入依赖的package包/类
/**
* Applies an text edit to a compilation unit. Filed bug 117694 against jdt.core.
* @param cu the compilation unit to apply the edit to
* @param edit the edit to apply
* @param save is set, save the CU after the edit has been applied
* @param monitor the progress monitor to use
* @throws CoreException Thrown when the access to the CU failed
* @throws ValidateEditException if validate edit fails
*/
public static void applyEdit(ICompilationUnit cu, TextEdit edit, boolean save, IProgressMonitor monitor) throws CoreException, ValidateEditException {
IFile file= (IFile) cu.getResource();
if (!save || !file.exists()) {
cu.applyTextEdit(edit, monitor);
} else {
if (monitor == null) {
monitor= new NullProgressMonitor();
}
monitor.beginTask(CorextMessages.JavaModelUtil_applyedit_operation, 2);
try {
IStatus status= Resources.makeCommittable(file, null);
if (!status.isOK()) {
throw new ValidateEditException(status);
}
cu.applyTextEdit(edit, new SubProgressMonitor(monitor, 1));
cu.save(new SubProgressMonitor(monitor, 1), true);
} finally {
monitor.done();
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:JavaModelUtil.java
注:本文中的org.eclipse.jdt.internal.corext.ValidateEditException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论