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


Java RefactoringStatus.hasFatalError方法代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.RefactoringStatus.hasFatalError方法的典型用法代码示例。如果您正苦于以下问题:Java RefactoringStatus.hasFatalError方法的具体用法?Java RefactoringStatus.hasFatalError怎么用?Java RefactoringStatus.hasFatalError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ltk.core.refactoring.RefactoringStatus的用法示例。


在下文中一共展示了RefactoringStatus.hasFatalError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkFinalConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
public final RefactoringStatus checkFinalConditions(
    IProgressMonitor pm, CheckConditionsContext context)
    throws CoreException, OperationCanceledException {
  ResourceChangeChecker checker =
      (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
  IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
  RefactoringStatus result = doCheckFinalConditions(pm, context);
  if (result.hasFatalError()) return result;
  IFile[] changed = getChangedFiles();
  for (int i = 0; i < changed.length; i++) {
    deltaFactory.change(changed[i]);
  }
  fRenameModifications = computeRenameModifications();
  fRenameModifications.buildDelta(deltaFactory);
  fRenameModifications.buildValidateEdits(
      (ValidateEditChecker) context.getChecker(ValidateEditChecker.class));
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:JavaRenameProcessor.java

示例2: checkInitialConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  try {
    pm.beginTask("", 1); // $NON-NLS-1$

    RefactoringStatus result =
        Checks.validateModifiesFiles(
            ResourceUtil.getFiles(new ICompilationUnit[] {fCu}), getValidationContext());
    if (result.hasFatalError()) return result;

    VariableDeclaration declaration = getVariableDeclaration();

    result.merge(checkSelection(declaration));
    if (result.hasFatalError()) return result;

    result.merge(checkInitializer(declaration));
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:InlineTempRefactoring.java

示例3: validateModifiesFiles

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
public static RefactoringStatus validateModifiesFiles(IFile[] filesToModify, Object context) {
	RefactoringStatus result = new RefactoringStatus();
	IStatus status = Resources.checkInSync(filesToModify);
	if (!status.isOK()) {
		result.merge(RefactoringStatus.create(status));
	}
	status = Resources.makeCommittable(filesToModify, context);
	if (!status.isOK()) {
		result.merge(RefactoringStatus.create(status));
		if (!result.hasFatalError()) {
			result.addFatalError(RefactoringCoreMessages.Checks_validateEdit);
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:16,代码来源:Checks.java

示例4: analyzeSelection

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus analyzeSelection(RefactoringStatus status) {
	fInputFlowContext = new FlowContext(0, fMaxVariableId + 1);
	fInputFlowContext.setConsiderAccessMode(true);
	fInputFlowContext.setComputeMode(FlowContext.ARGUMENTS);

	InOutFlowAnalyzer flowAnalyzer = new InOutFlowAnalyzer(fInputFlowContext);
	fInputFlowInfo = flowAnalyzer.perform(getSelectedNodes());

	if (fInputFlowInfo.branches()) {
		String canHandleBranchesProblem = canHandleBranches();
		if (canHandleBranchesProblem != null) {
			status.addFatalError(canHandleBranchesProblem, JavaStatusContext.create(fCUnit, getSelection()));
			fReturnKind = ERROR;
			return status;
		}
	}
	if (fInputFlowInfo.isValueReturn()) {
		fReturnKind = RETURN_STATEMENT_VALUE;
	} else if (fInputFlowInfo.isVoidReturn() || (fInputFlowInfo.isPartialReturn() && isVoidMethod() && isLastStatementSelected())) {
		fReturnKind = RETURN_STATEMENT_VOID;
	} else if (fInputFlowInfo.isNoReturn() || fInputFlowInfo.isThrow() || fInputFlowInfo.isUndefined()) {
		fReturnKind = NO;
	}

	if (fReturnKind == UNDEFINED) {
		status.addError(RefactoringCoreMessages.FlowAnalyzer_execution_flow, JavaStatusContext.create(fCUnit, getSelection()));
		fReturnKind = NO;
	}
	computeInput();
	computeExceptions();
	computeOutput(status);
	if (status.hasFatalError()) {
		return status;
	}

	adjustArgumentsAndMethodLocals();
	compressArrays();
	return status;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:40,代码来源:ExtractMethodAnalyzer.java

示例5: checkSelectedNodes

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
protected final void checkSelectedNodes() {
	super.checkSelectedNodes();
	RefactoringStatus status = getStatus();
	if (status.hasFatalError()) {
		return;
	}
	ASTNode node = getFirstSelectedNode();
	if (node instanceof ArrayInitializer) {
		status.addFatalError(RefactoringCoreMessages.CodeAnalyzer_array_initializer, JavaStatusContext.create(fCUnit, node));
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:13,代码来源:CodeAnalyzer.java

示例6: performChange

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Performs the change associated with this proposal.
 * <p>
 * Subclasses may extend, but must call the super implementation.
 *
 * @throws CoreException
 *             when the invocation of the change failed
 */
protected void performChange() throws CoreException {

	Change change= null;
	try {
		change= getChange();
		if (change != null) {

			change.initializeValidationData(new NullProgressMonitor());
			RefactoringStatus valid= change.isValid(new NullProgressMonitor());
			if (valid.hasFatalError()) {
				IStatus status = new Status(IStatus.ERROR, JavaLanguageServerPlugin.PLUGIN_ID, IStatus.ERROR,
						valid.getMessageMatchingSeverity(RefactoringStatus.FATAL), null);
				throw new CoreException(status);
			} else {
				IUndoManager manager= RefactoringCore.getUndoManager();
				Change undoChange;
				boolean successful= false;
				try {
					manager.aboutToPerformChange(change);
					undoChange= change.perform(new NullProgressMonitor());
					successful= true;
				} finally {
					manager.changePerformed(change, successful);
				}
				if (undoChange != null) {
					undoChange.initializeValidationData(new NullProgressMonitor());
					manager.addUndo(getName(), undoChange);
				}
			}
		}
	} finally {

		if (change != null) {
			change.dispose();
		}
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:46,代码来源:ChangeCorrectionProposal.java

示例7: checkFinalConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context)
    throws CoreException {
  pm.beginTask("", 1); // $NON-NLS-1$
  try {
    RefactoringStatus status = validateDestination(fDestination);
    if (status.hasFatalError()) {
      return status;
    }
    fMoveArguments = new MoveArguments(fDestination, isUpdateReferences());

    ResourceChangeChecker checker =
        (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
    IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();

    for (int i = 0; i < fResourcesToMove.length; i++) {
      IResource resource = fResourcesToMove[i];
      IResource newResource = fDestination.findMember(resource.getName());
      if (newResource != null) {
        status.addWarning(
            Messages.format(
                RefactoringCoreMessages.MoveResourcesProcessor_warning_destination_already_exists,
                BasicElementLabels.getPathLabel(newResource.getFullPath(), false)));
        deltaFactory.delete(newResource);
      }
      ResourceModifications.buildMoveDelta(deltaFactory, fResourcesToMove[i], fMoveArguments);
    }
    return status;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:MoveResourcesProcessor.java

示例8: isValid

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * This implementation of {@link Change#isValid(IProgressMonitor)} tests the modified resource
 * using the validation method specified by {@link #setValidationMethod(int)}.
 */
public RefactoringStatus isValid(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask("", 2); // $NON-NLS-1$
  try {
    RefactoringStatus result = new RefactoringStatus();
    IResource resource = getModifiedResource();
    checkExistence(result, resource);
    if (result.hasFatalError()) return result;
    if (fValidationMethod == VALIDATE_DEFAULT) return result;

    ValidationState state = new ValidationState(resource);
    state.checkModificationStamp(result, fModificationStamp);
    if (result.hasFatalError()) return result;
    state.checkSameReadOnly(result, fReadOnly);
    if (result.hasFatalError()) return result;
    if ((fValidationMethod & VALIDATE_NOT_READ_ONLY) != 0) {
      state.checkReadOnly(result);
      if (result.hasFatalError()) return result;
    }
    if ((fValidationMethod & SAVE_IF_DIRTY) != 0) {
      state.saveIfDirty(result, fModificationStamp, new SubProgressMonitor(pm, 1));
    }
    if ((fValidationMethod & VALIDATE_NOT_DIRTY) != 0) {
      state.checkDirty(result);
    }
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:ResourceChange.java

示例9: RenameSupport

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RenameSupport(RenameJavaElementDescriptor descriptor) throws CoreException {
  RefactoringStatus refactoringStatus = new RefactoringStatus();
  fRefactoring = (RenameRefactoring) descriptor.createRefactoring(refactoringStatus);
  if (refactoringStatus.hasFatalError()) {
    fPreCheckStatus = refactoringStatus;
  } else {
    preCheck();
    refactoringStatus.merge(fPreCheckStatus);
    fPreCheckStatus = refactoringStatus;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:RenameSupport.java

示例10: checkSignature

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus checkSignature(boolean resolveBindings) {
  RefactoringStatus result = new RefactoringStatus();
  checkMethodName(result);
  if (result.hasFatalError()) return result;

  checkParameterNamesAndValues(result);
  if (result.hasFatalError()) return result;

  checkForDuplicateParameterNames(result);
  if (result.hasFatalError()) return result;

  try {
    RefactoringStatus[] typeStati;
    if (resolveBindings)
      typeStati =
          TypeContextChecker.checkAndResolveMethodTypes(
              fMethod, getStubTypeContext(), getNotDeletedInfos(), fReturnTypeInfo);
    else
      typeStati =
          TypeContextChecker.checkMethodTypesSyntax(
              fMethod, getNotDeletedInfos(), fReturnTypeInfo);
    for (int i = 0; i < typeStati.length; i++) result.merge(typeStati[i]);

    result.merge(checkVarargs());
  } catch (CoreException e) {
    // cannot do anything here
    throw new RuntimeException(e);
  }

  // checkExceptions() unnecessary (IType always ok)
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:ChangeSignatureProcessor.java

示例11: checkInitialConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/** {@inheritDoc} */
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  if (pm == null) pm = new NullProgressMonitor();
  RefactoringStatus result = new RefactoringStatus();
  pm.beginTask("", 10); // $NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.ProcessorBasedRefactoring_initial_conditions);

  result.merge(getProcessor().checkInitialConditions(new SubProgressMonitor(pm, 8)));
  if (result.hasFatalError()) {
    pm.done();
    return result;
  }
  pm.done();
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:ProcessorBasedRefactoring.java

示例12: checkInitialConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor monitor) throws CoreException {
  RefactoringStatus result = super.checkInitialConditions(monitor);
  if (result.hasFatalError()) return result;
  try {
    monitor.beginTask("", 3); // $NON-NLS-1$
    if (!fActivationChecked) {
      // the following code may change the method to be changed.
      IMethod method = getMethod();
      fOriginalMethod = method;

      ITypeHierarchy hierarchy = null;
      IType declaringType = method.getDeclaringType();
      if (!declaringType.isInterface())
        hierarchy = getCachedHierarchy(declaringType, new SubProgressMonitor(monitor, 1));

      IMethod topmost = getMethod();
      if (MethodChecks.isVirtual(topmost))
        topmost = MethodChecks.getTopmostMethod(getMethod(), hierarchy, monitor);
      if (topmost != null) initialize(topmost);
      fActivationChecked = true;
    }
  } finally {
    monitor.done();
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:RenameVirtualMethodProcessor.java

示例13: doCheckFinalConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
protected RefactoringStatus doCheckFinalConditions(
    IProgressMonitor pm, CheckConditionsContext context)
    throws CoreException, OperationCanceledException {
  try {
    initAST();
    initNames();
    pm.beginTask("", 1); // $NON-NLS-1$

    RefactoringStatus result = checkNewElementName(fNewName);
    if (result.hasFatalError()) return result;
    createEdits();
    if (!fIsComposite) {
      LocalAnalyzePackage[] localAnalyzePackages =
          new RenameAnalyzeUtil.LocalAnalyzePackage[] {fLocalAnalyzePackage};
      result.merge(
          RenameAnalyzeUtil.analyzeLocalRenames(
              localAnalyzePackages, fChange, fCompilationUnitNode, true));
    }
    return result;
  } finally {
    pm.done();
    if (fIsComposite) {
      // end of life cycle for this processor
      fChange = null;
      fCompilationUnitNode = null;
      fTempDeclarationNode = null;
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:RenameLocalVariableProcessor.java

示例14: performSourceRestore

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private void performSourceRestore(IProgressMonitor monitor) throws CoreException {
  monitor.beginTask(RefactoringCoreMessages.MoveResourceChange_progress_restore_source, 3);
  try {
    fRestoreSourceChange.initializeValidationData(new SubProgressMonitor(monitor, 1));
    RefactoringStatus restoreStatus =
        fRestoreSourceChange.isValid(new SubProgressMonitor(monitor, 1));
    if (!restoreStatus.hasFatalError()) {
      fRestoreSourceChange.perform(new SubProgressMonitor(monitor, 1));
    }
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:MoveResourceChange.java

示例15: analyzeAffectedCompilationUnits

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus analyzeAffectedCompilationUnits() throws CoreException {
  RefactoringStatus result = new RefactoringStatus();
  fReferences = Checks.excludeCompilationUnits(fReferences, result);
  if (result.hasFatalError()) return result;

  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences));
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:RenameFieldProcessor.java


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