本文整理汇总了Java中org.eclipse.jdt.core.IMember.isReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java IMember.isReadOnly方法的具体用法?Java IMember.isReadOnly怎么用?Java IMember.isReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IMember
的用法示例。
在下文中一共展示了IMember.isReadOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustOutgoingVisibility
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
/**
* Adjusts the visibilities of the referenced element from the search match found in a compilation
* unit.
*
* @param match the search match representing the element declaration
* @param monitor the progress monitor to use
* @throws JavaModelException if the visibility could not be determined
*/
private void adjustOutgoingVisibility(final SearchMatch match, final IProgressMonitor monitor)
throws JavaModelException {
final Object element = match.getElement();
if (element instanceof IMember) {
final IMember member = (IMember) element;
if (!member.isBinary() && !member.isReadOnly() && !isInsideMovedMember(member)) {
adjustOutgoingVisibilityChain(member, monitor);
}
}
}
示例2: checkWritabilitiy
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
private RefactoringStatus checkWritabilitiy(IMember member, PreconditionFailure failure) {
if (member.isBinary() || member.isReadOnly())
return createError(failure, member);
return new RefactoringStatus();
}
开发者ID:ponder-lab,项目名称:Migrate-Skeletal-Implementation-to-Interface-Refactoring,代码行数:6,代码来源:MigrateSkeletalImplementationToInterfaceRefactoringProcessor.java
示例3: adjustVisibility
import org.eclipse.jdt.core.IMember; //导入方法依赖的package包/类
private RefactoringStatus adjustVisibility(
IMember whoToAdjust,
ModifierKeyword neededVisibility,
boolean alsoIncreaseEnclosing,
IProgressMonitor monitor)
throws CoreException {
Map<IMember, IncomingMemberVisibilityAdjustment> adjustments;
if (isRewriteKept(whoToAdjust.getCompilationUnit())) adjustments = fIntermediaryAdjustments;
else adjustments = new HashMap<IMember, IncomingMemberVisibilityAdjustment>();
int existingAdjustments = adjustments.size();
addAdjustment(whoToAdjust, neededVisibility, adjustments);
if (alsoIncreaseEnclosing)
while (whoToAdjust.getDeclaringType() != null) {
whoToAdjust = whoToAdjust.getDeclaringType();
addAdjustment(whoToAdjust, neededVisibility, adjustments);
}
boolean hasNewAdjustments = (adjustments.size() - existingAdjustments) > 0;
if (hasNewAdjustments && ((whoToAdjust.isReadOnly() || whoToAdjust.isBinary())))
return RefactoringStatus.createErrorStatus(
Messages.format(
RefactoringCoreMessages
.IntroduceIndirectionRefactoring_cannot_update_binary_target_visibility,
new String[] {
JavaElementLabels.getElementLabel(whoToAdjust, JavaElementLabels.ALL_DEFAULT)
}),
JavaStatusContext.create(whoToAdjust));
RefactoringStatus status = new RefactoringStatus();
// Don't create a rewrite if it is not necessary
if (!hasNewAdjustments) return status;
try {
monitor.beginTask(RefactoringCoreMessages.MemberVisibilityAdjustor_adjusting, 2);
Map<ICompilationUnit, CompilationUnitRewrite> rewrites;
if (!isRewriteKept(whoToAdjust.getCompilationUnit())) {
CompilationUnitRewrite rewrite =
new CompilationUnitRewrite(whoToAdjust.getCompilationUnit());
rewrite.setResolveBindings(false);
rewrites = new HashMap<ICompilationUnit, CompilationUnitRewrite>();
rewrites.put(whoToAdjust.getCompilationUnit(), rewrite);
status.merge(
rewriteVisibility(
adjustments,
rewrites,
new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
rewrite.attachChange(
(CompilationUnitChange) fTextChangeManager.get(whoToAdjust.getCompilationUnit()),
true,
new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
}
} finally {
monitor.done();
}
return status;
}