本文整理汇总了Java中org.eclipse.jdt.internal.core.util.Util.setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java Util.setReadOnly方法的具体用法?Java Util.setReadOnly怎么用?Java Util.setReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.core.util.Util
的用法示例。
在下文中一共展示了Util.setReadOnly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveContent
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private void saveContent(PackageFragment dest, String destName, TextEdit edits, String sourceEncoding, IFile destFile) throws JavaModelException {
try {
// TODO (frederic) remove when bug 67606 will be fixed (bug 67823)
// fix bug 66898
if (sourceEncoding != null) destFile.setCharset(sourceEncoding, this.progressMonitor);
// end todo
}
catch (CoreException ce) {
// use no encoding
}
// when the file was copied, its read-only flag was preserved -> temporary set it to false
// note this doesn't interfere with repository providers as this is a new resource that cannot be under
// version control yet
Util.setReadOnly(destFile, false);
ICompilationUnit destCU = dest.getCompilationUnit(destName);
applyTextEdit(destCU, edits);
destCU.save(getSubProgressMonitor(1), this.force);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CopyResourceElementsOperation.java
示例2: updateReadOnlyPackageFragmentsForCopy
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private void updateReadOnlyPackageFragmentsForCopy(IContainer sourceFolder, PackageFragmentRoot root, String[] newFragName) {
IContainer parentFolder = (IContainer) root.resource();
for (int i = 0, length = newFragName.length; i <length; i++) {
String subFolderName = newFragName[i];
parentFolder = parentFolder.getFolder(new Path(subFolderName));
sourceFolder = sourceFolder.getFolder(new Path(subFolderName));
if (sourceFolder.exists() && Util.isReadOnly(sourceFolder)) {
Util.setReadOnly(parentFolder, true);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:CopyResourceElementsOperation.java
示例3: updateReadOnlyPackageFragmentsForMove
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private void updateReadOnlyPackageFragmentsForMove(IContainer sourceFolder, PackageFragmentRoot root, String[] newFragName, boolean sourceFolderIsReadOnly) {
IContainer parentFolder = (IContainer) root.resource();
for (int i = 0, length = newFragName.length; i < length; i++) {
String subFolderName = newFragName[i];
parentFolder = parentFolder.getFolder(new Path(subFolderName));
sourceFolder = sourceFolder.getFolder(new Path(subFolderName));
if ((sourceFolder.exists() && Util.isReadOnly(sourceFolder)) || (i == length - 1 && sourceFolderIsReadOnly)) {
Util.setReadOnly(parentFolder, true);
// the source folder will be deleted anyway (move operation)
Util.setReadOnly(sourceFolder, false);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:CopyResourceElementsOperation.java
示例4: copyResource
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
protected void copyResource(IResource source, IResource destination) throws CoreException {
IPath destPath = destination.getFullPath();
try {
source.copy(destPath, IResource.FORCE | IResource.DERIVED, null);
} catch (CoreException e) {
// handle the case when the source resource is deleted
source.refreshLocal(0, null);
if (!source.exists()) return; // source resource was deleted so skip it
throw e;
}
Util.setReadOnly(destination, false); // just in case the original was read only
}