当前位置: 首页>>代码示例>>Java>>正文


Java IMember.isReadOnly方法代码示例

本文整理汇总了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);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:MemberVisibilityAdjustor.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:61,代码来源:IntroduceIndirectionRefactoring.java


注:本文中的org.eclipse.jdt.core.IMember.isReadOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。